I know that SQL Server 2000 doesn't support PIVOT
table.
Let me tell you all about my issue and maybe you can help me with a solution.
I have a table with clients and projects.
client project
------ --------
A 1111
A 1112
B 2222
B 2223
C 1234
D 1235
I would like to swap rows with columns. So the output table will be:
A B C D
---------------------------
1111 2222 1234 1235
1112 2223 NULL NULL
It's possible in SQL Server 2008 simply using PIVOT
table, but the server we need to use is 2000.
The clients and projects are dynamic of course.
Is there anything to get this result?
UPDATE:
I know that there are many questions in here about pivot in SQL Server. I read almost everything. One solution is to do many case statements, but this doesn't return what I need.
It will return:
A B C D
----------------------------
1111 NULL NULL NULL
1112 NULL NULL NULL
NULL 2222 NULL NULL
NULL 2223 NULL NULL
NULL NULL 1234 NULL
NULL NULL NULL 1235
Which is not what I want since I will be exporting it to EXCEL with drop-down lists and it will create a lot of empty strings in the lists.