Hallo
a friend of mine (Gabriel Wyss) wrote this little scalar funktion for me in Microsoft SQL.
Since I use Postgres I tried to transform to Postgres syntax, but it did'nt work.
Can anybody please translate this little piece of code for me?
-----------------------------------------------------------------------------------------------------------------
CREATE FUNCTION [dbo].[OrteListe]
(
@haupt_id SYSNAME
)
RETURNS NVARCHAR(MAX)
AS
BEGIN
DECLARE @s NVARCHAR(MAX);
SELECT @s = COALESCE(@s + N', ', N'') + kind
FROM kind
WHERE haupt_id = @haupt_id
ORDER BY kind
RETURN (@s);
END
-----------------------------------------
Thanks and greetings from Berlin
Ralf