Site Sponsored By: SQLDSC - SQL Server Desired State Configuration
Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
EnameSmith,John,Joe,royCan any one pls help me in writing a query for this?
madhivanan
Premature Yak Congratulator
22864 Posts
Posted - 2010-03-15 : 06:47:19
http://www.sqlteam.com/forums/topic.asp?TOPIC_ID=81254MadhivananFailing to plan is Planning to fail
senthil_nagore
Master Smack Fu Yak Hacker
1007 Posts
Posted - 2010-03-15 : 06:55:26
Try this tooselect (SELECT CAST (Ename AS VARCHAR(25)) + ',' as [text()] FROM Employee ORDER BY EID FOR XML PATH('') )Senthil.C------------------------------------------------------[Microsoft][ODBC SQL Server Driver]Operation canceledhttp://senthilnagore.blogspot.com/
visakh16
Very Important crosS Applying yaK Herder
52326 Posts
Posted - 2010-03-15 : 09:52:17
quote:Originally posted by senthil_nagore Try this tooselect STUFF((SELECT ',' + CAST (Ename AS VARCHAR(25)) FROM Employee ORDER BY EID FOR XML PATH('') ),1,1,'')Senthil.C------------------------------------------------------[Microsoft][ODBC SQL Server Driver]Operation canceledhttp://senthilnagore.blogspot.com/
------------------------------------------------------------------------------------------------------SQL Server MVPhttp://visakhm.blogspot.com/