July 22, 2010 at 1:06 am
My table have following format
Table ID Entry No.Dimension Code Dimension Value Code
330000771812707BRANCH 1201010
330000771812707DEPT 182310
330000771812707EMP 7058
330000771812707SBU 18
330000771812721BRANCH 2202020
330000771812721DEPT 100020
330000771812721EMP 7079
330000771812721SBU 10
i want to convert like this
Table ID Entry No. SBU BRANCH DEPTEMP
3300007718127071812010101823107058
3300007718127211022020201000207079
pls give the query for the same
regards
mariyappan
July 22, 2010 at 1:50 am
hi,
Use Pivot query ...
see the below link....which gives more details....
http://www.mssqltips.com/tip.asp?tip=1019
Regards,
Chowdary
July 22, 2010 at 2:12 am
Using PIVOT .......
See this link .this will give you example Query......
Link:
http://www.sql-programmers.com/Blog/tabid/153/EntryId/6/Using-PIVOT-and-UNPIVOT.aspx
SQL Server Programmers and Consultants
July 22, 2010 at 4:54 am
As the others have already mentioned, you need to PIVOT your data. Take a look at the two Pivot/Cross-tab articles (Part 1 and Part 2) linked to in my signature.
Wayne
Microsoft Certified Master: SQL Server 2008
Author - SQL Server T-SQL Recipes
Viewing 4 posts - 1 through 3 (of 3 total)
You must be logged in to reply to this topic. Login to reply