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 |
|
pvinesh
Starting Member
3 Posts |
Posted - 2008-03-14 : 06:35:09
|
| I have a table with only one column asEmp_NameABCDEI want to display this data asEmp_NameA, B, C, D, EIs this possible? I am using SQL server 2005.Any help is appreciated.Regards,Vinesh |
|
|
ranganath
Posting Yak Master
209 Posts |
Posted - 2008-03-14 : 06:49:16
|
| Hi,Try with this deCLARE @StrConcat tABLE (col1 nvarchar(10),col2 nvarchar(10))insert into @StrConcatselect 'db1','host1'union all select 'db1','host2'union all select 'db1','host3'union all select 'db2','host1'union all select 'db2','host2'union all select 'db3','host2'union all select 'db3','host3'select col1, stuff( ( select ','+ col2 from @StrConcat t1 where t2.col1 = t1.col1 for xml path('')),1,1,'')from @StrConcat t2group by col1order by col1 |
 |
|
|
pvinesh
Starting Member
3 Posts |
Posted - 2008-03-14 : 07:02:34
|
| Thanks for your reply!Could you please eloborate it more as I am new to sql server.Regards,Vinesh |
 |
|
|
|
|
|
|
|