/ 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.
- DECLARE @IDlist varchar(100)
- SELECT @IDlist = COALESCE(@IDlist + ', ', '') + CAST(id AS varchar(5)) FROM tbl
- SELECT @IDlist
You need to login to post a comment.