0

I have been searching for about a week now and I was wondering if anyone may have a clue. I wrote a package to do the following:

  1. loop through a parent folder and its subfolders for a csv with a particular naming structure (works)

  2. Create a table for each .csv based on the enumeration of each file (works).

  3. Import the data into sql server in their own tables with the file name that was created as the table name and not OLE DB Destination (which does not work). It works if it there is destination folder for everything, but when I use table variable that does not work.

What I did was add an Execute SQL task to the for each container to create a table with a variable for the file path that is mapped as an expression in the for each container in a create table query under property sqlstatementsource expression. The tables are created, but when I use the variable that was mapped for the for each loop as the table name or variable in OLE DB Destination I get an error asking for me to check if the table exists. The tables are created, but I cannot get the insertion of the data into their own tables. Even when I bypass the error of "Destination table has not been provided" and run the package. I set delayValidation as true and still nothing. SSIS from what I have seen so far does some cool things. However, I am stuck right now. What else am I doing wrong?

Thanks for everything.

Kevy
  • 21
  • 7
  • Looping the files is easy, the import with different metadata(each file with it's own columns) not so much. You have the foreach component, if i remember correctly it loop all the files (for example *.csv) on a folder and it's sub folders and give you the fullpath to a variable. The import part... not so easy since each file as it's own columns and standard SSIS DTF has fixed metadata – mxix Mar 21 '16 at 22:01
  • How many distinct .csv files do you have - I mean with different metadata? Is this fixed or can you get a .csv file with new metadata without notice? – Amit Sukralia Mar 21 '16 at 22:48
  • I'm sorry if I was not clear but all of the files I want which are csvs have the same structure and formatted the same. Same columns lengths and etc. It's just getting them out of the subfolders and finding them by their file name is the problem. – Kevy Mar 22 '16 at 00:16

0 Answers0