Recently you might have read a post regarding theĀ approach on how to convert a multi-row result set into a comma delimited string. Reading further, you can find an alternate approach.

There have been tasks assigned to me to return records in a comma delimited string vs. just standard results set from SQL.

For example, take this simple query:

This simple query would return the results of:
AK
AL
AR
AZ
CA
CO
CT
DE
FL
GA
HI
IA
ID
IL
IN

The conversion of this query from rows to comma delimited would look like:

This modified simple query would return the results of:
AK, AL, AR, AZ, CA, CO, CT, DE, FL, GA, HI, IA, ID, IL, IN, …

Like this post? Share it!