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)
 column format to row format...

Author  Topic 

dnf999
Constraint Violating Yak Guru

253 Posts

Posted - 2007-03-05 : 07:39:31
Hi I need to manipulate some client data into SQL.

The data is in one column and I need it in sql in row format (one row per supplier):


AAA123
Address1
Address2
Address3
Postcode
AAA456
Address1
Address2
Address3
Address4
Postcode
ABC567
Address1
address2
Address3
Address4
Postcode
etc....

Required output:
AAA123 Address1 Address2 Address3 Postcode
AAA456 Address1 Address2 Address3 Address4 Postcode
etc...


The supplier number is in a fixed format i.e. 3 alpha's + 3 numerics
BUT the number of address lines can vary per supplier.

Does anyone have, or can produce sample code so I can transform this data in SQL?

Thanks!




khtan
In (Som, Ni, Yak)

17689 Posts

Posted - 2007-03-05 : 07:42:24
see http://sqljunkies.com/WebLog/amachanic/archive/2004/11/10/5065.aspx


KH

Go to Top of Page

mahesh_bote
Constraint Violating Yak Guru

298 Posts

Posted - 2007-03-05 : 11:17:38
hi khtan,

dnf999 wants to achive through single column. in a link it reqd id so that it can be achive. any idea?


Mahesh
Go to Top of Page
   

- Advertisement -