/ Published in: SQL
If you ever need to build a comma delimited list out of a column in SQL you can easily do this using the COALESCE function.
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
DECLARE @IDlist VARCHAR(100) SELECT @IDlist = COALESCE(@IDlist + ', ', '') + CAST(id AS VARCHAR(5)) FROM tbl SELECT @IDlist