sql server - TSQL use joined table data as function parameters -
can briefly explain why not possible use values of table parameters joined function?
;create function "foo" ( @id int ) returns @result table ( "value" int ) begin insert @result select @id * 2 return end; ;with "cte" ( select "id" = 1 union select 2 ) select * cte , "foo"(cte."id")
the last line throws error ( ~ cte."id" can not bound ). doesn't matter if it's cte or table.
joining result sets coming out table valued function done using cross apply
.
Comments
Post a Comment