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 |
|
mail2chandus
Starting Member
1 Post |
Posted - 2003-12-11 : 04:20:26
|
| Hello all,I have a problem with query formatting.i have a table which Details which has fieldsName -varchar(20)Roll - varchar(4)When I say Select * from Detailsthe result isName RollNO--------------- ---------------------Shekar 007Ravi 008and so on.But I want the data to be displayed as followsShekar-007,ravi-008,ramu-009,...and so on.Can anyone help me in this regardthanksShekar |
|
|
mohdowais
Sheikh of Yak Knowledge
1456 Posts |
Posted - 2003-12-11 : 04:33:37
|
| Something like:DECLARE @str varchar(1000)SELECT @str = ISNULL(@str + ', ', '') + (Name + RollNo) FROM tableNamePRINT @strSearch the forums for CSV (comma separated values), you'll plenty of resourcesOwaisWe make a living out of what we get, but we make a life out of what we give. |
 |
|
|
|
|
|