The text of this article is not in this database — only its details are. Read it on the old site: Comma Separated Value in SQL Query
5 Comments
Join the conversation! Your thoughts help the community grow.
Sign in to leave a comment.
The text of this article is not in this database — only its details are. Read it on the old site: Comma Separated Value in SQL Query
Join the conversation! Your thoughts help the community grow.
Sign in to leave a comment.
Sachin PatelPosted Jul 26, 2023, 7:10 AM
We may use STRING_AGG for SQL 2017+ - SQL Fiddle for this example - http://www.sqlfiddle.com/#!18/7d09de/9
Jignesh TrivediPosted Apr 9, 2013, 4:05 AM
COALESCE is nothing but the version of ISNULL, which can take more than two parameters. For XML Path is one of the techniques for find out comma separated value. Same thing we can achieve by using recursive CTEs, SQL CLR function, recursive UDFs, and cursor based approach etc.
Anil KumarPosted Apr 9, 2013, 12:19 AM
Good work Jignesh, but I would like to use COALESCE with help of a variable instead this approach. That one will be more better than this in understanding point to efficiency.
Jignesh TrivediPosted Apr 8, 2013, 11:29 PM
Thanks for commenting, Yes you are right, if the article contain text (SQL Syntax), than it more beneficial to reader. My original article document is containing SQL syntax, not image. But I don’t know how it converted from text to image.
Former memberPosted Apr 8, 2013, 8:15 PM
Nice article Jingesh . I wonder if you can put SQL Snippet instead of images then reader may be more benefited. /DJ