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.
Author |
Topic |
kondap
Starting Member
6 Posts |
Posted - 2009-01-29 : 14:51:25
|
I have a requirement to import data frome excel to sql server.The columns in Excel areSummary,Resource1,Resource1Link,Resource2,Resouce2Link etc...Sql server table strucutre is: 'SummaryResourceTable'Columns: Summary, Resource, ResourceLinkWhat is the best way to load all the Resources(1,2,3,...) and corresponding ResourceLinks(1,2,3...) to 'Resource' and 'ResourceLInk' columnsI have many columns in this structure. Any help is greatly appreciatedI am using Sql Server 2005.Thanks |
|
sodeep
Master Smack Fu Yak Hacker
7174 Posts |
Posted - 2009-01-29 : 15:31:45
|
Load data from Excel to Staging table with Excel Source and OLEDB destinationUse UNPIVOT TASK in SSIS to Massage the layoutImport back to Destination table |
 |
|
kondap
Starting Member
6 Posts |
Posted - 2009-01-30 : 09:44:46
|
Do you have any link/blog on how to use UNPIVOT transformation. Iam new to SSIS. |
 |
|
sodeep
Master Smack Fu Yak Hacker
7174 Posts |
Posted - 2009-01-30 : 10:21:36
|
quote: Originally posted by kondap Do you have any link/blog on how to use UNPIVOT transformation. Iam new to SSIS.
Watch the video and learn from Brian Knights:http://www.jumpstarttv.com/ssis-stumpers-v1-unpivot-example_268.aspx |
 |
|
kondap
Starting Member
6 Posts |
Posted - 2009-01-30 : 14:36:29
|
This is great link. thanks Sodeep.Now I am able to load Resources and ResourceLinks without any issues.Table: ResourceID, Resources, ResourceLinks1)But if I have to import data for another column 'ResourceID' into the same table, I am not able to accomplish.Error: PivotKeyvalue is not valid. In an UnPivot transform with more than one unpivoted destination column, the set of pivot key values must match exactly. I tried unique names but still the same error.2)To load another set of data (Events, EventLinks) into the same table, do I need to use another 'UNPIVOT' transformation?Appreciate your helpThanks |
 |
|
sodeep
Master Smack Fu Yak Hacker
7174 Posts |
Posted - 2009-01-30 : 15:20:17
|
You need to use UNPIVOT. |
 |
|
|
|
|
|
|