Importing multiple files into multiple tables

  • I have a directory with 200+ txt files to import into SQL tables in a database. Each file name is the exact table name in the database(without the file extension, obviously). I am looping through each file with a for each loop and a variable is mapped and set in the source connection properties for the Expressions -> ConnectionString property, so each name will go into that variable without the file extensions, correct? Now, I set the variable name to the table name in the destination for the table name under "Data Access Mode", but it is giving an error...do I have to assign variables to each part, (Connection String and Name)? Does anyone have a quick setup for this? Does every source file definitely need a separate connection?

    Thanks!

  • robert myers (9/27/2010)


    I have a directory with 200+ txt files to import into SQL tables in a database. Each file name is the exact table name in the database(without the file extension, obviously). I am looping through each file with a for each loop and a variable is mapped and set in the source connection properties for the Expressions -> ConnectionString property, so each name will go into that variable without the file extensions, correct? Now, I set the variable name to the table name in the destination for the table name under "Data Access Mode", but it is giving an error...do I have to assign variables to each part, (Connection String and Name)? Does anyone have a quick setup for this? Does every source file definitely need a separate connection?

    Thanks!

    What is the error message?

    How are you trying to upload each file?



    Alvin Ramard
    Memphis PASS Chapter[/url]

    All my SSC forum answers come with a money back guarantee. If you didn't like the answer then I'll gladly refund what you paid for it.

    For best practices on asking questions, please read the following article: Forum Etiquette: How to post data/code on a forum to get the best help[/url]

  • Invalid object name in the destination. Trying to load each file from the directory and it's corresponding table in the DB

  • How are you trying to do the upload?

    Which task is throwing the error?



    Alvin Ramard
    Memphis PASS Chapter[/url]

    All my SSC forum answers come with a money back guarantee. If you didn't like the answer then I'll gladly refund what you paid for it.

    For best practices on asking questions, please read the following article: Forum Etiquette: How to post data/code on a forum to get the best help[/url]

  • Im trying to do the upload through a flat file source and OLE DB destination. OLE DB destination is giving the error on the incorrect name

  • I'm assuming you're trying to do the uploads using a Dataflow. If you're doing so and your tables and files have differnet structures, then I hate to say that what you're trying to do will not work. Dataflows need more than just the source and destinations. The mapping needs to be redone for every structure you'll be using.

    If this is something that you'll be doing regularly then I would recommend that you build a DataFlow for each table. You can then use the filename to help you pick whch DataFlow to execute the upload.

    You may also want to take a look at Bulk Insert, and BCP. They may prove to be easier to set up for this number of files.



    Alvin Ramard
    Memphis PASS Chapter[/url]

    All my SSC forum answers come with a money back guarantee. If you didn't like the answer then I'll gladly refund what you paid for it.

    For best practices on asking questions, please read the following article: Forum Etiquette: How to post data/code on a forum to get the best help[/url]

  • check your Mail... PM..

Viewing 7 posts - 1 through 6 (of 6 total)

You must be logged in to reply to this topic. Login to reply