Reputation:
I need to pass parameter to inline function for the top level CTE. Is it possible to do that?
Here is something what i need.
with a
(
select * from table1
),
b as
(
select * from
(
select * from inline_function(a.parameter1)
)
as c
)
Upvotes: 0
Views: 87
Reputation: 138990
You probably mean to call the function once for each row returned by the CTE a
.
To do that you should use APPLY.
with a
(
select *
from dbo.table1
),
b as
(
select c.*
from a
cross apply dbo.inline_function(a.parameter1) as c
)
Upvotes: 1