SQL Server Forums
Profile | Register | Active Topics | Members | Search | Forum FAQ
 
Register Now and get your question answered!
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 SQL Server 2000 Forums
 SQL Server Development (2000)
 Passing a field from a query into a function
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

chrisnorris007
Starting Member

USA
18 Posts

Posted - 10/08/2013 :  17:27:27  Show Profile  Reply with Quote
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

India
52317 Posts

Posted - 10/08/2013 :  23:57:07  Show Profile  Reply with Quote
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
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
SQL Server Forums © 2000-2009 SQLTeam Publishing, LLC Go To Top Of Page
This page was generated in 0.05 seconds. Powered By: Snitz Forums 2000