Evaluates the arguments in order and returns the current value of the first expression that initially does not evaluate to NULL.
DECLARE @str NVARCHAR(256)
SELECT @str = COALESCE(@str + ', ', '') + cast(CatID
AS NVARCHAR)
FROM TableName
WHERE ID = 1
SELECT @str
END
Tags
SQL SERVER