Re: Can't get table function to work -
11-22-2010
, 05:44 PM
Hi Tom,
If you need to use values from one table in the joined table
expression, you need to use APPLY rather than JOIN. So you use:
SELECT t1.nID
FROM table1 AS t1
CROSS APPLY dbo.udf_somefunction(t1.nID) AS f;
Or, if you want to preserve rows that produce an empty resultset in
the applied table expression:
SELECT t1.nID
FROM table1 AS t1
OUTER APPLY dbo.udf_somefunction(t1.nID) AS f;
--
Hugo Kornelis, SQL Server MVP
My SQL Server blog: http://sqlblog.com/blogs/hugo_kornelis |