Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Invoking UDF in a select statement

Status
Not open for further replies.

jino

Programmer
Apr 1, 2004
41
CA
Hi,

I have an inline User defined function. It goes like this:

CREATE FUNCTION LookUpCodeDesc (@LookupType varchar(50), @LLookupCode varchar(50))
RETURNS TABLE
AS
RETURN (Select LookUpDesc AS Name
from LookUp
Where LookupType = @LookupType
And LookupCode = @LLookupCode)

Can I invoke this function in a SELECT statement? What are the other alternatives to this issue?

Thanks in advance,

Jino
 
yes

select dbo.LookUpCodeDesc (value 1, value 2) as [New Column Name]
From ...

value 1 and value 2 can be columns, variables, contants... just as long as the datatype match up.

Jason Meckley
Database Analyst
WITF
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top