Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Store filename in variable and create tables with the filename in SSIS

Tags:

sql

ssis

I've few excel source files in one folder in SSIS. I want to pull data from these excel files and load in to SQL tables. My problem is I want to save all the files names one by one and want to create SQL table with exactly same name as filename and then want to load each excel file in corresponding table. Please help me how to create a package for this.

like image 765
user3220846 Avatar asked Dec 29 '25 16:12

user3220846


1 Answers

Jayvee has presented the high level view which is good enough! Let me add in bit detail.

I am assuming that you have dynamic Excel file connection.

  1. Declare a variable and named it as FileName. And assign it the first file name which is available in the folder. FileName

  2. Place Foreach Loop Container and double click on it. Specify the Folder: and Files: as shown in image below. enter image description here

  3. In the same Foreach Loop Editor, go to Variable Mappings. Select Variable from drop down list. This is the same variable which we defined in first step. Set its Index to 0. Click OK. enter image description here

  4. Remaining task is same as Jayvee explained.

See this link for further help. And this for Result Set Property Not Set Correctly. I think setting ResultSet property to SingleRow will do the job.

like image 119
Faizan Mubasher Avatar answered Dec 31 '25 05:12

Faizan Mubasher



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!