SQL Clone
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 


dynamic excel columns into dynamic table


dynamic excel columns into dynamic table

Author
Message
Shanmuga Raj
Shanmuga Raj
Valued Member
Valued Member (73 reputation)Valued Member (73 reputation)Valued Member (73 reputation)Valued Member (73 reputation)Valued Member (73 reputation)Valued Member (73 reputation)Valued Member (73 reputation)Valued Member (73 reputation)

Group: General Forum Members
Points: 73 Visits: 344
I have excel with dynamic column and i want to load into table creating dynamic columns.
I need to add new columns in the same table
kindly suggest me the approch for the same
source excel -1
=========
Emp_Id No_Frame

source excel -2
=========
Emp_Id No_Frame No_Sales No_Month No_Purchase

like these, the source excel will have more / less columns. based on this, i need to insert into my database table

I willnot be able to use SP

select *
FROM OPENROWSET(''Microsoft.ACE.OLEDB.12.0'',''Excel 8.0;Database

as my server doesnot allow to install any provider of MS Sad
Vikash Kumar Singh
Vikash Kumar Singh
SSC-Enthusiastic
SSC-Enthusiastic (110 reputation)SSC-Enthusiastic (110 reputation)SSC-Enthusiastic (110 reputation)SSC-Enthusiastic (110 reputation)SSC-Enthusiastic (110 reputation)SSC-Enthusiastic (110 reputation)SSC-Enthusiastic (110 reputation)SSC-Enthusiastic (110 reputation)

Group: General Forum Members
Points: 110 Visits: 243
What is common between your Excel source and Database Table? Does the column name or sequence of column as you have shown in the example appears as they are in DB table.

I would suggest you to

1. Create a Script Task in SSIS and read the excel columns one by one and create a data table out of it.

2. After that you can compare the columns you have in data table with your Database table and add any new column that does not exist.

3. After that you can build a dynamic INSERT statement and pass on the column values as parameter.

If you can share your database table strucuture it might help to provide some solution. At this point the requirement seems incomplete.

If you do not know how to read Excel columns into SSIS you can refer below link or search on sqlservercentral.com or google it.


SSIS: How to read Excel Meta Data?


Vikash Kumar Singh || www.singhvikash.in
Go


Permissions

You can't post new topics.
You can't post topic replies.
You can't post new polls.
You can't post replies to polls.
You can't edit your own topics.
You can't delete your own topics.
You can't edit other topics.
You can't delete other topics.
You can't edit your own posts.
You can't edit other posts.
You can't delete your own posts.
You can't delete other posts.
You can't post events.
You can't edit your own events.
You can't edit other events.
You can't delete your own events.
You can't delete other events.
You can't send private messages.
You can't send emails.
You can read topics.
You can't vote in polls.
You can't upload attachments.
You can download attachments.
You can't post HTML code.
You can't edit HTML code.
You can't post IFCode.
You can't post JavaScript.
You can post emoticons.
You can't post or upload images.

Select a forum

































































































































































SQLServerCentral


Search