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 |
gangadhara.ms
Aged Yak Warrior
549 Posts |
Posted - 2011-01-30 : 22:05:48
|
Dear All,I have table where i need to do the column and row concatenation for some of the fields.Table structure:Id address1 address2 address31 A B C2 X Y ZMy output should be in the form of ID changes1 address1=A address2=B address3=C2 address1=X address2=Y address3=ZHow to do this pls help me.Thanks,Gangadhara MSSQL Developer and DBA |
|
tkizer
Almighty SQL Goddess
38200 Posts |
|
gangadhara.ms
Aged Yak Warrior
549 Posts |
Posted - 2011-01-30 : 22:53:09
|
Thanks Tara.As this is for the data extraction i need to do it in T-SQL only.Don't have any other front end application to process the data.This output format is required to pull the data in database only.Thanks,Gangadhara MSSQL Developer and DBA |
 |
|
sathishmangunuri
Starting Member
32 Posts |
Posted - 2011-01-31 : 00:02:37
|
Hi,As per my understand i have written this.Is this work for you?create table #t1(id int, address1 varchar(10),address2 varchar(10),address3 varchar(10))insert into #t1 values(1,'x','y','z')insert into #t1 values(2,'a','b','c')select id,'address1='+address1,'address2='+address2,'address3='+address3 from #t1sathish |
 |
|
MIK_2008
Master Smack Fu Yak Hacker
1054 Posts |
Posted - 2011-01-31 : 00:05:40
|
check this out! Select ID, 'Address1='+Address1+' address2='+Address2 +' Address3='+Address3 As ChangesFrom TableName |
 |
|
|
|
|
|
|