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)
 Passing a field from a query into a function

Author  Topic 

chrisnorris007
Starting Member

18 Posts

Posted - 2013-10-08 : 17:27:27
select ProductCode from Product p inner join
dbo.uf_C_GetCInv('10-10-2013',p.productcode,0) u on p.productcode=u.productcode


as you can see here I am attempting to use ProductCode from the Product table as a parameter to my tabular function uf_Commissary_GetCWarehouseInv. Why isnt this working?

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2013-10-08 : 23:57:07
you cant pass values like this to a UDF using a join. for that you need to use APPLY operator which is available only from SQL 2005 and above.

See scenario 4

http://visakhm.blogspot.in/2010/01/multipurpose-apply-operator.html

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/
https://www.facebook.com/VmBlogs
Go to Top of Page
   

- Advertisement -