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)
 This ones a brain teaser!

Author  Topic 

Charlie Green
Starting Member

1 Post

Posted - 2008-09-18 : 06:58:41
Im looking for some help with reformating some data with Transact SQL. My problem is that I have data in the below format, I need to get this into one row with multiple colums for the text values.

Existing format:

TimeStamp Text App
2008/09/10 12:44:12.629 QTE040060892 CCR
2008/09/10 12:44:12.629 CCR
2008/09/10 12:44:12.629 10/09/2008 CCR
2008/09/10 12:44:12.629 7EN93WGGXH6PANUDINTE CCR
2008/09/10 12:44:12.629 MOT CCR
2008/09/10 12:44:12.629 999 CCR
2008/09/10 12:44:12.629 WEB CCR
2008/09/10 12:44:12.629 1 CCR
2008/09/10 12:44:12.629 NUD CCR
2008/09/10 12:44:12.629 1015.00 CCR
2008/09/10 12:44:12.629 2 CCR
2008/09/10 12:44:12.629 DIAM CCR
2008/09/10 12:44:12.629 CCR
2008/09/10 12:44:12.629 X CCR
2008/09/10 12:44:12.629 END CCR
2008/09/10 12:44:12.629 707.93 CCR
2008/09/10 12:44:12.629 1 CCR
2008/09/10 12:44:12.629 RAC CCR
2008/09/10 12:44:12.629 CCR
2008/09/10 12:44:12.629 X CCR
2008/09/10 12:44:12.629 CCR

Required Format:
TimeStamp Qte_Ref Qte_Seq_No Qte_date Client_Ref
2008/09/10 12:44:12.629 QTE040060892 10/09/2008 7EN93WGGXH6PANUDINTE

I need the data to be in one row with the values in the text column to be split out into seperate coloumns...

Any help on this would be much appreciated as its giving me brain ache :-)

spirit1
Cybernetic Yak Master

11752 Posts

Posted - 2008-09-18 : 07:16:41
search around here for pivot or cross tab.

_______________________________________________
Causing trouble since 1980
Blog: http://weblogs.sqlteam.com/mladenp
Speed up SSMS development: www.ssmstoolspack.com <- version 1.0 out!
Go to Top of Page
   

- Advertisement -