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)
 Query help

Author  Topic 

aswindba1
Yak Posting Veteran

62 Posts

Posted - 2013-04-03 : 15:12:30

I need to pull the info from excel to the Database table through SSIS. I need logic for below scenario.

Excel Look like below:

Server Name Cost Type Values
SAB245 DRU 200
SAB246 DRU 2001
SAB247 TAPE 300
SAB248 TAPE 3001
SAB249 DISK 100
SAB250 DISK 1001


Output table should be:

Server Name DRU Cost TAPE Cost Disk Cost
SAB245 200 Null Null
SAB246 2001 Null Null
SAB247 Null 300 Null
SAB248 Null 3001 Null
SAB249 Null Null 100
SAB250 Null Null 1001

Please let me know if you need more explanation.

thanks

aswindba1
Yak Posting Veteran

62 Posts

Posted - 2013-04-03 : 16:30:50

I need to pull the info from excel to the Database table through SSIS. I need logic for below scenario.

Excel Look like below:

Server Cost Values
SAB245 DRU 200
SAB246 DRU 2001
SAB247 TAPE 300
SAB248 TAPE 3001
SAB249 DISK 100
SAB250 DISK 1001


Output table should be:

Server DRU TAPE Disk
SAB245 200 Null Null
SAB246 2001 Null Null
SAB247 Null 300 Null
SAB248 Null 3001 Null
SAB249 Null Null 100
SAB250 Null Null 1001

Please let me know if you need more explanation.

thanks

Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2013-04-04 : 01:28:26
it looks like a straight forward task.
You just need a data flow task with excel source and OLEDB destination to connect to table
In between you need a derived column to create three new columns DRU,TAPE and Disk

the expression will be like

([Cost]=="DRU"? [Values] : NULL(DT_I4)) for DRU
([Cost]=="TAPE"? [Values] : NULL(DT_I4)) for TAPE
([Cost]=="Disk"? [Values] : NULL(DT_I4)) for Disk

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

- Advertisement -