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 2008 Forums
 SSIS and Import/Export (2008)
 dynamic Pivot and Unpivot in SSIS

Author  Topic 

Kalaiselvan
Posting Yak Master

112 Posts

Posted - 2013-09-02 : 10:03:00
hi,
Posted Previously About Need of Pivot and Unpivot in SSIS. The Same now I need to Do it Dynamically.

Ex: Excel
[COUNTRY] [BRAND] [JAN12] [FEB12] [MAR12]
IND VVD 500 300 200
IND P&G 350 250 450
IND AB 75 300 500

Using Unpivot Can Bring the Month Columns to Rows. Unpivoted Output will be [COUNTRY] [BRAND] [MONTH] [VALUE]. Whereas Month Column will has 3 Rows (jan,Feb and Mar).
If the Input Excel has many Month columns, Then How we can do it Dynamically without changing Unpivot Data Flow Component. First 2 Columns will be Fixed, Month columns will be Dynamic.
The Same For Pivoting Columns.

Regards,
Kalai

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2013-09-02 : 10:26:54
if you want to do it dynamically best thing is to do this in t-sql. put result in a staging table and use it for later processing.

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/
https://www.facebook.com/VmBlogs
Go to Top of Page
   

- Advertisement -