Dynamically passing the text file name to DTS package to transfer the data from the text file to the DB table

  • Hi,

    Currently I am using a DTS package to transfer the data from a text file to a MS SQL Database Table.

    It works fine. But the problem is I have to use this DTS to do the above job for n number of files to the same Database table.

    This file and its path should be passed as paramater to the DTS

    so that the DTS can read the file specified file from the path and move the data

    Is there a way dynamically passing the file names to the DTS.

    I am executing the DTS thru a Stroed Proc

    Thanks

     

  • What you should do is first create a DTS package. Then create two Global Variables for the package, one for the Filename and the other for the Path.

    Then, add an ExecuteSQLTask to the package. Write the statement to execute the SP inside it and pass the Global Variables to the input parameters of the ExecuteSQLTask.

    Then, just before executing the package, set the global variables with the filename and path of your choice.

    Think that should do it. Let me know if you have any problems.

  • You can pass paraameters to a DTS package. There is also a looping example here: http://www.sqldts.com/default.aspx?246 that might work for you.

  • Thanks Steve

    It is working fine

     

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

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