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 2000 Forums
 Transact-SQL (2000)
 Any help will be appreciated!

Author  Topic 

dreamaboutnothing
Starting Member

47 Posts

Posted - 2004-10-29 : 22:38:23
Hi,
i have a table with data like this
column1|column2|column3|
12 |AB |xyz|
90 |cg |dfg|
88 |df |ghj|

My output should look like this 12+'/'+AB+'/'+xyz+'::' +90+'/'+cg+'/'+dfg+'::'+third record
column is separated by / and record is separated by ::
These values will not be fixed values.There can be 10 to 15 records.How should i do it without a cursor.Any help will be appreciated. Thanks

kselvia
Aged Yak Warrior

526 Posts

Posted - 2004-10-29 : 23:24:39
Try this:

declare @output varchar(8000)
select @output = coalesce(@output+'::','') + column1+'/'+column2+'/'+column3 from mytable
select @output


--Ken
I want to die in my sleep like my grandfather, not screaming in terror like his passengers.
Go to Top of Page

dreamaboutnothing
Starting Member

47 Posts

Posted - 2004-10-29 : 23:35:15
Hi Ken,
It did work! Wow, You are great! Thank You so much.
Go to Top of Page
   

- Advertisement -