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)
 Table Records Transpose/Format help

Author  Topic 

Demitemi
Starting Member

2 Posts

Posted - 2008-08-22 : 17:25:05
I have data in a table as shown below (Before) that I need to use t-SQL to dynamically transpose/format into the format in (After) below.
Will like the DOS order to be from earlier to later if possible. Any assistance will be appreciated.

Thanks.

Before:

Account DOS
4573 2/27/2006
8489 5/31/2007
6364 1/19/2006
6364 2/13/2006
6353 10/24/2006
6353 8/20/2007
6353 11/27/2006
6353 2/5/2007
6353 3/27/2007
6353 1/4/2007
5751 2/12/2007
4567 9/27/2006
4567 2/8/2007
4567 7/5/2007
4567 3/20/2007
4567 3/21/2006
4567 2/20/2007
4567 6/13/2006
8742 3/14/2007
8742 8/2/2007
8742 2/22/2007

After:

Account DOS1 DOS2 DOS3 DOS4 DOS5 DOS6
4573 2/27/2006
8489 5/31/2007
6364 1/19/2006 2/13/2006
6353 10/24/2006 8/20/2007 11/27/2006 2/5/2007 3/27/2007 1/4/2007
5751 2/12/2007
4567 9/27/2006 2/8/2007 7/5/2007 3/20/2007 3/21/2006 2/20/2007 6/13/2006
8742 3/14/2007 8/2/2007 2/22/2007


tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2008-08-22 : 17:26:18
Do this in your application and not in SQL.

Tara Kizer
Microsoft MVP for Windows Server System - SQL Server
http://weblogs.sqlteam.com/tarad/

Subscribe to my blog
Go to Top of Page
   

- Advertisement -