Skip to content Skip to sidebar Skip to footer

Pass Parameter In Table Valued Function Using Select Statement

I have created a table valued return function which returns me a table . here is call of my function as follow SELECT * FROM dbo.[StateFixedTaxesCalculation](3020,16,1,1006) and

Solution 1:

use outer/cross apply:

select *
from Employee as E
    cross apply dbo.[StateFixedTaxesCalculation](3020, E.EmployeeId, 1, 1006) as TC

if you still have to filter by TC.EmployeeId = E.EmployeeId, you can do this with subquery:

select *
from Employee as E
    cross apply (select TT.*
        from dbo.[StateFixedTaxesCalculation](3020, E.EmployeeId, 1, 1006) as TT
        where TT.EmployeeId = E.EmployeeId
    ) as TC

Post a Comment for "Pass Parameter In Table Valued Function Using Select Statement"