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.

 All Forums
 SQL Server 2005 Forums
 Transact-SQL (2005)
 Help needed

Author  Topic 

aravindt77
Posting Yak Master

120 Posts

Posted - 2007-12-12 : 05:48:21
Hi,

Table Name -- Test

Col1 Col2
----------
1 ABC
2 DEF
3 GHI

Result must be
--------------

ABC,DEF,GHI

Can anybody help me ??


Regards

Aravind

SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2007-12-12 : 06:01:26
See http://www.sqlteam.com/forums/topic.asp?TOPIC_ID=81254



E 12°55'05.25"
N 56°04'39.16"
Go to Top of Page

ranganath
Posting Yak Master

209 Posts

Posted - 2007-12-12 : 08:50:21
Hi,

Try This

Declare @T Table(id int, col1 varchar(10))
Insert into @T
Select 1, 'A' union all
Select 2, 'B' union all
Select 3, 'C'

Declare @Str Varchar(1000)

select @str = COALESCE ( @str + ',' , '' ) + Col1 from @T
Select @Str
Go to Top of Page
   

- Advertisement -