DTSRUN in .bat file does not terminate

  • Hi Folks,

    I'm running a simple DTS package by executing a .bat file.  The .bat

    file does however not terminate.  Any ideas?

    See my .bat file below:

     

    SET ServerName=<servername>

    SET Package=<my dtspackage name>

    SET logfile="NewLog.Log"

    cls

    echo Server is %ServerName%

    echo About to run DTS package %Package%

    REM --------------------------------------------------------

    REM Run the DTS package

    REM --------------------------------------------------------

    echo Starting DTS package...

    echo.

    pause

    if exist %logfile% del %logfile%

    dtsrun /S %ServerName% /E /N %Package% /L %logfile%

    if ERRORLEVEL 1 GOTO DTSERR

    GOTO DTSOK

    TSERR

    echo.

    echo.

    echo An error in %Package% has occurred. Import terminated

    GOTO END

    TSOK

    echo.

    echo  %Package% run has succeeded.

    :END

    echo.

    echo Batch file ended

    pause  

  • You do realize that your last command in the bat file is PAUSE, don't you? The last thing in the file is saying to wait, so it is waiting. Take out the PAUSE and add EXIT.


    My blog: SQL Soldier[/url]
    SQL Server Best Practices:
    SQL Server Best Practices
    Twitter: @SQLSoldier
    My book: Pro SQL Server 2008 Mirroring[/url]
    Microsoft Certified Master: SQL Server, Data Platform MVP
    Database Engineer at BlueMountain Capital Management[/url]

  • Thanks for the response.

    The batch never made it as far as the pause statement.  I've

    removed the pause and added exit ... unfortunately, same result.

     

    Regards.

     

    Craig

  • How are you executing the bat file? Do you see the command window and are you interacting with it as it runs? I ask because there is another pause command in the middle of the file.

    REM --------------------------------------------------------

    REM Run the DTS package

    REM --------------------------------------------------------

    echo Starting DTS package...

    echo.

    pause

    if exist %logfile% del %logfile%

    dtsrun /S %ServerName% /E /N %Package% /L %logfile%


    My blog: SQL Soldier[/url]
    SQL Server Best Practices:
    SQL Server Best Practices
    Twitter: @SQLSoldier
    My book: Pro SQL Server 2008 Mirroring[/url]
    Microsoft Certified Master: SQL Server, Data Platform MVP
    Database Engineer at BlueMountain Capital Management[/url]

  • Hi Rob,

    At this stage I've yanked everything from the bat file. I literally only have the dtsrun command (with its parameters):

    Bat file:

    -------------------------------------------------

    dtsrun /S<servername> /E /N<packagename> /L "c:\logfile.log" /W True

    EXIT

    -------------------------------------------------

    When I look at the command window, it just scrolls across the screen until I hit Ctrl+C.

    (I've even resorted to setting up a test package that just loads a file into a table).

     

  • Does the DTS package runs succesfully when you run it within Enteprise Manager?

    Peter Gadsby
    Business Intelligence Consultant
    www.hgconsult.co.uk

  • Does the DTS package runs succesfully when you run it within Enteprise Manager?  Yes

  • What do the contents of the log file say for the last execute by the bat file?


    My blog: SQL Soldier[/url]
    SQL Server Best Practices:
    SQL Server Best Practices
    Twitter: @SQLSoldier
    My book: Pro SQL Server 2008 Mirroring[/url]
    Microsoft Certified Master: SQL Server, Data Platform MVP
    Database Engineer at BlueMountain Capital Management[/url]

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

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