Chce stworzyć funkcje która wywołuje w sobie samą siebie(a bardziej przepisać funkcje z postgresa), na wzór coś takiego:
CREATE FUNCTION dbo.guests_recursive_select_helper(@value BIGINT)
RETURNS table
AS
return
(
SELECT c.child_value
FROM dbo.guest_table_links c
WHERE c.parent_guest_id = @value
AND c.valid_to_timestamp IS NULL
UNION ALL
SELECT dbo.guests_recursive_select_helper(guest_table_links.child_guest_id) as f
FROM dbo.guest_table_links d
WHERE d.parent_guest_id = @value
AND d.valid_to_timestamp IS NULL
);
Leci mi tutaj:
Cannot find either column "dbo" or the user-defined function or aggregate "dbo.guests_recursive_select_helper", or the name is ambiguous
Nie za bardzo miałem styczność wcześniej z mssql, hmmm... nie może rozpoznać drugiego selecta przy wywoływaniu funkcji?