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)
 Excel sheet to Database data loading?

Author  Topic 

learntsql

524 Posts

Posted - 2012-05-04 : 06:47:01
Hi all,

I have an excel sheet with the following columns.
This excel sheet we get daily by adding new dates to the same sheet again.


Sno-Group-TableDesc-Date1-Date2-Date3-------
1-A-Table1-10-20-10------
2-B-Table2-11-12-23------
--
--

Now we have to load this data into seperate tables which are specified in TableDesc column of excel sheet.

T1
---------

ID|Date|Group|Value
-------------------
1|Date1|A|10
2|Date2|A|20
3|Date3|A|10


T2
---------

ID|Date|Group|Value
-------------------
1|Date1|B|11
2|Date2|B|12
3|Date3|B|23


Same table contains data for multiple groups.

--To get the table names(T1,T2,...) we maintain seperate table to store table names and TableDESC

TableInfo
---------
ID|TableName|TableDesc
----------------------
1|T1|Table1
2|T2|Table2
--
--
--

Now my requirement is how to load the excel sheet data into defferent tables by getting the table names from TableName column of TableInfo Table.
If the new dates entered into sheet it has to load only the new dates data into respective table.

Please guide me how to do it with SSIS Package?
TIA

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2012-05-05 : 01:54:01
add a data flow task with excel source which connects to excel sheet. Add a conditional task to create output branches based on TableDesc field values. Connect each branch to OLEDB destination tasks which points to corresponding tables where you want to dump the data

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/

Go to Top of Page

learntsql

524 Posts

Posted - 2012-05-07 : 01:39:49
Thank you Visakh.
I will try.
TIA.
Go to Top of Page

learntsql

524 Posts

Posted - 2012-05-07 : 01:56:32
Hi Visakh,

I am trying to work out it.
Everything was fine but how to convert excel sheet date columns as rows of sql server table.
all date values should be inserted in single date column.
Please guide me.
TIA.
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2012-05-07 : 19:49:11
hmm...whats the need of that. so what about other columns values? didnt understand need of merging multiple rows like that

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/

Go to Top of Page

learntsql

524 Posts

Posted - 2012-05-07 : 23:57:51
Let me explain more clear.

I have excel data like

Sno-Group-TableDesc-1May2012-2May2012-3May2012-------
1-A-Table1-10-20-10------
2-B-Table2-11-12-23------

Now i want to load in following format
--Table1

Sno|Group|Date|Value
----------------
1|A|1-May-2012|10
2|A|2-May-2012|20
3|A|3-May-2012|10

--Table2

Sno|Group|Date|Value
----------------
1|B|1-May-2012|11
2|B|2-May-2012|12
3|B|3-May-2012|23

I think its more clear now.
Plz guide me.
TIA.
Go to Top of Page
   

- Advertisement -