How to write batch file to run dts pacakge(important)

  • I have a package in which the datapump is used.

    The global variables are the server name and the database name both for source n target,

    there are two more global varibles say as varible1 and varible2

    now how shd i declare this things in the batch file along with the pacakge name.

    it shd also include log file, the serve name (on which ever server we run the bacth file or the package is saved.)

    can any any one show me the example how to write the batch file.

    thanks in advance.

  • Here's one that I created to run a DTS package.  Note that the DTSRun command is encrypted as I don't have one on hand that's in plain text.  The entry in BOL for the DTSRun utility explains how to specify global variables and they're values.

    Greg

    cls

    echo Running Job Script please Wait .....

    @echo off

    echo --------------------------------------------------------------------

    echo Load Warrant table & Datemodified table in PRD database on SQL Server 

    echo

    echo Date Created: 05/05/2004

    echo --------------------------------------------------------------------

    echo --------------------------------------------------------------------

    echo.

    echo This batch file executes a Data Transformation Services package called

    echo Warrant Load which truncates the database tables and loads data from text

    echo files at d:\Batch\Warrant\Data into tables in the UP database.

    echo.

    DTSRun /~Z0xC6D6B7203CBBFC2A81982407491C31660905FDA1C816500CF08CF5F6DF54384655B680055C12A46C4A71ADA77C3370A768CA1C0A97C5C3039B33CC5C359D56ABC70AD77198E49918B8946174E5CC37E35F63CF9A2CFA9FFD8DD9B058B43717961AD7B8ACF1330481F4EA6615388C396EC51FF1BD25AE0E67D5FDA241579DCD5DCC9E124321FABF36E20BBDED43202F0975B9D7C093B2572CFB0EB977FF054F978CD09C077DF0AD970AFD3C3BA8E81EBEB7EC1ADBEDA7E58243FD13E3580EC760A4893BB7EABDEE81DDD9A3A9B5FEF2140CC646A7A1A20513CB6005A6491BD222E371D232DA04DE2585D1043CDF1824C2E7B3674C1F22C0535F92A5A2168E6C39B067E294D5BBCA939E571D32270BA98EE4EC625FFEC3BB069529ED9CBF88453AB5B405A1322DC17E73A27E409D24D175B4AA3AC69140E691DA1E30

    echo ........... data load completed successfully

    goto end

    :end

     

     

    Greg

  • A plain text example of the DTSRun command with switches looks like:

    DTSRun /Sserver /Llogfile /Npackagename /E

    The switches are:

    /S the server where the package is stored

    /L the path of the DTS log file (if not exists, will be created)

    /N the DTS package name

    /E trusted security

    You've then got the /A switch for passing global variables. For example:

    /A"GlobalVariable":Type:"Value"

    /A"gvString":8:="myString"

    /A"gvInt":3:="myInt"

    There is a good explanation and complete table of GlobalVariable data type IDs here:

    http://www.supinfo-projects.com/fr/2004/dtsrun_asp_a/3/



    Ade

    A Freudian Slip is when you say one thing and mean your mother.
    For detail-enriched answers, ask detail-enriched questions...[/url]

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

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