Link to home
Start Free TrialLog in
Avatar of Zolf
ZolfFlag for United Arab Emirates

asked on

SQL Query help

HEllo there,

How can i have all the output of the result in this format record1,record2,record3.
the query i am running is SELECT name FROM username.now i want all of the name to be like this in the result name1,name2,name3. i am using MSSQL 2008.

cheers
Zolf
ASKER CERTIFIED SOLUTION
Avatar of Guy Hengel [angelIII / a3]
Guy Hengel [angelIII / a3]
Flag of Luxembourg image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Zolf

ASKER

cheers !!
Avatar of Zolf

ASKER

Can you please explain what is FOR XML PATH ('')) does.
please run these statements to "see" what it does:
SELECT ',' + name FROM username FOR XML PATH ('')
SELECT name FROM username FOR XML PATH