How to Get SQL Column Values as Comma Separated String

Smith
Smith
None
2568 Points
74 Posts

Hi,

How to Get SQL Column Values as Comma Separated String?

Views: 8662
Total Answered: 1
Total Marked As Answer: 1
Posted On: 26-Jun-2015 05:53

Share:   fb twitter linkedin
Answers
Brian
Brian
Moderator
2232 Points
14 Posts
         

Hi Smith,

Use XML Path method as:

SELECT UserName+',' AS [text()] from tbl_Login_User FOR XML PATH('')


It will return username with seperated by commas(,).

Posted On: 26-Jun-2015 08:55
 Log In to Chat