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.
| Author |
Topic |
|
paritosh
Starting Member
42 Posts |
Posted - 2012-08-20 : 10:51:23
|
| HI ALL,HOW TO COVERT COLUMN DATA IN TO ROW WITH COMMA SEPARATORDATA LIKE THAT :-TABLE NAME : - TEST COLUMN NAME : - COL1ORIGINAL DATA ARE :-COL11234567145REQUIRED DATA ARE :-1,2,3,4,5,6,7,1,4,5HOW TO DO THIS ....THANKS IN ADVANCE.... |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2012-08-20 : 10:55:37
|
| [code]DECLARE @CSVList varchar(max)SELECT @CSVList=STUFF((SELECT ',' + CAST(COL1 AS varchar(5))FROM TableORDER BY Col1FOR XML PATH('')),1,1,'')SELECT @CSVList[/code]------------------------------------------------------------------------------------------------------SQL Server MVPhttp://visakhm.blogspot.com/ |
 |
|
|
|
|
|