sql server 2008 - (How) Can I place a with sql query in a table value function? -
i put following query return of table value function.
;with org ( select id org_unit id = @id_org_unit union select parent_id org_unit c join org p on p.id = c.id ) select * org
i tried create such function i'm resorting stored procedure in despair...
is possible create function return result?
create function test_func(@id_org_unit int) returns table return ( org ( select id org_unit id = @id_org_unit union select parent_id org_unit c join org p on p.id = c.id ) select * org );
Comments
Post a Comment