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
 Transact-SQL (2000)
 Using UDF that returns a table variable in joins

Author  Topic 

HeliosRex
Starting Member

7 Posts

Posted - 2008-07-31 : 20:38:00
I have a user defined function that takes an integer parameter and returns a table variable with 4 columns. I want to use this function in a query by joining with another table. Is this possible at all?

The function takes productid as input parameter and returns a table with 4 columns - detail1, detail2, detail3, detail4.

I want to write a query that will be similar to the following.

select a.id, b.detail1, b.detail2
from product a, fn_getdetails (a.productid)
where a.id = @id

Apparently I am not able to get it to work.

Is this possible at all? If so can someone correct my query and point me in the right direction? I appreciate any kind of help with this problem.

Thanks in advance,
Helios

SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2008-08-01 : 03:47:38
You can't do this in SQL Server 2000.
With SQL Server 2000, you can only return a scalar value from the function, when you pass a column value to the function.



E 12°55'05.25"
N 56°04'39.16"
Go to Top of Page
   

- Advertisement -