Return Comma-Delimited String

If you need to return a comma-delimited string such as a list of keywords from titles on your web page you can easily do this.

DECLARE @TopicNames varchar(200)
SELECT @TopicNames = COALESCE(@TopicNames + ',', '') + Topic FROM Topica
SELECT @TopicNames AS Keywords

Source: Chuck Dearbeck
Viewed 7506 times