Set destination tablename dynamically

  • Hi,

    I've had a search on the forum but can't find an exact answer to my question. in short:

    Is it possible to set the destination name of an import from txt file to a database table dynamically.

    I want to set the name of the txt file to pick up (done this OK) and the db & table to import into at run time based on a parameter that's passed in.

    Hope you can help (otherwise I need 18 almost identical DTS packages!!!!!!).

     

    Thnx,

     

    Dan

  • Use global variable for Keeping your run time file name. Include Dynamic Propery Task for setting the Destination table name. And set a workflow so as to do the actual task only after the completion of Dynamic Property task. See  DTSRUN  /A parameter for passing parameter value.

    e.g.

    DTSRUN /F "' + @PKG_PATH + '\SOME.DTS"'             

      + ' /A SOMEVAR1:8=' + @COMPANY_CODE              

      + ' /A SOMEVAR2:2=' + CAST(@PROCESS_TYPE AS VARCHAR(1))              

      + ' /A SOMEVAR3_DATE:5=' + STR(CONVERT(FLOAT, @PROCESS_DATE), 18, 12) 

    Hope this will help

    Johnson

Viewing 2 posts - 1 through 1 (of 1 total)

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