views:

27

answers:

1

I need to use a function which returns a table, in a inner join sentence passing a parameter. When executed, the sentence like this is not working.

SELECT T0.Code,T0.Data1,T0,Data2 FROM  [dbo].[FNGet_Data] (T1.Code,'2010-01','USD') T0 
INNER JOIN 
Codes T1 ON T1.Code=T0.Code

When executed the sentence using a constant parameter works ok

SELECT T0.Code,T0.Data1,T0,Data2 FROM  [dbo].[FNGet_Data] ('5200','2010-01','USD') T0 
INNER JOIN 
Codes T1 ON T1.Code=T0.Code

Is it possible to call the function FNGet_Data using as parameter the value of another table?

+2  A: 

Have a look at Using APPLY

astander
Thanks very much.
Salvador