SSIS Pivoting Data
Hi, My source data is this: CUSTOMER ID YEAR WEEK PRODUCT A PRODUCT B PRODUCT C PRODUCT D 100 2010 18 2 10 5 8 100 2010 19 6 8 9 4 100 2010 20 9 10 3 2 200 2010 18 2 8 3 10 200 2010 19 2 9 3 11 I need the output like this: [18] [19] [20] PRODUCT A 2 6 9 PRODUCT B 10 8 10 PRODUCT C 5 9 3 PRODUCT D 8 4 2 (I know that the Row Pivot is 1, Column Pivot is 2 and for Quantity, it is 3. )...Can someone help how to solve this using Pivot Transformation in SSIS 2008? Many Thanks Sharath..
May 11th, 2011 5:49am

What you will need to do is first UNPIVOT the data so it looks like this: Customer Year Week Product Qty 100 2010 18 A 2 100 2010 18 B 10 etc. Your five rows of 4 Products would result in 20 rows of un-pivoted data. Then you can re-pivot on Week Suggestion: Start with a Unpivot transform in SSIS and after that have a Row Count and put in a Data Viewer between the two so you can see what your results are. After you get the unpivot working, put in your pivot and another Data Viewer after that. Read BOL for help with these transforms.Todd C - MSCTS SQL Server 2005 - Please mark posts as answered where appropriate.
Free Windows Admin Tool Kit Click here and download it now
May 11th, 2011 8:08am

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics