Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 SQL Server Development (2000)
 Showing the return value from a table-type UDF

Author  Topic 

frank2
Starting Member

35 Posts

Posted - 2005-09-09 : 14:39:52
I have created a simple table-type UDF :

ALTER FUNCTION UDF_TV_GetLineage
(
@DescendantID int
)

RETURNS table

AS

RETURN
(
select SiteGroupsID, Lineage
from SiteGroups
where @DescendantID = Child
)

When I run this as a stored procedure I see the result set, no problem. What I want to do is run the function in the query analyzer and see the result set.

Running a scalar function in the Query analyzer is simple:

print DBO.UDF_MyScalar('TEST1;TEST2', 2, DEFAULT)

But when I attempt to run the table value function I get a not an object error.

Any suggestions or URL’s where I can go to see examples?

Thanks

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2005-09-09 : 14:50:35
SELECT * FROM dbo.UDF_TV_GetLineage(...)

Tara
Go to Top of Page

TG
Master Smack Fu Yak Hacker

6065 Posts

Posted - 2005-09-09 : 14:53:33
>>Any suggestions or URL’s where I can go to see examples?
Books Online. Look at the topic: CREATE FUNCTION

There are example UDFs and calls towards the bottom of the topic

Be One with the Optimizer
TG
Go to Top of Page

frank2
Starting Member

35 Posts

Posted - 2005-09-09 : 15:47:28
Ahhhh the table value function must be called from a SELECT. Thank you both:)
Go to Top of Page
   

- Advertisement -