Variable input textfile name -> database table

  • Several text files will be put into a collector directory on a daily basis. The presence of these files will trigger a DTS package that imports each file into the same database table The problem is the package was created using the DTS designer so we had to hardcode an input  filename - while the names of the actual input files vary. Any idea how I can get DTS to accept an input filename passed in at run time?

     

    TIA,

    Bill

     

     

  • assuming you have fixed number of files, otherwise you probably have to play activeX to connections.

     

    1. Create an ini file and use dynamic properties task to initialize the file name.

    eg.

    [file1]

    file_1=C:\nd\code_test.txt

    [file2]

    file_2=C:\nd\code_test2.txt

    ....

     

     

    2. If file name changed, you only need to update in the ini file.

     

     

     

  • See this link:

    http://www.sqldts.com/default.aspx?304,1

    it shows how to use the FSO to find files in a folder and pass the names to a package.

    MG

    "There are two ways of constructing a software design. One way is to make it so simple that there are obviously no deficiencies. And the other way is to make it so complicated that there are no obvious deficiencies."
    Tony Hoare

    "If you think it's expensive to hire a professional to do the job, wait until you hire an amateur." Red Adair.

  • Adding on to what MG says, you can schedule a job to kick off the package every minutes if you want around the clock processing. It's the same technique we use internally EOM to make sure we are caught up before running our EOM processing.

  • What i use to do is run a command line like this

     

    d:\

    cd "my files"

    Copy *.* allmyfiles.csv

    and on the DTS you conect to the allmyfiles.csv

    after execution delete the files.

    like this.

    d:\

    cd "my files"

    del *.*

    if you want to have a copy , copy the files before delete .

    Pedro R. Lopez
    http://madurosfritos.blogspot.com/[/url]

Viewing 5 posts - 1 through 4 (of 4 total)

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