- It allows me to execute the package from an automated scheduler program (we use autosys)
- Allows for a config file in a different location than when the package was created
- Outputs a log file in a specified location with the date in the file name
@echo off
FOR /F "tokens=2-4 delims=/ " %%i IN ('date /t') DO SET DATE=%%i-%%j-%%k
dtexec /FILE E:\SSIS_PACKAGES\PSFeedSSIS\PSFeedSSIS.dtsx /DECRYPT password /ConfigFile E:\SSIS_PACKAGES\PSFeedSSIS\PSStageConfig.dtsConfig /CHECKPOINTING OFF > E:\SSIS_PACKAGES\PSFeedSSIS\Logs\%DATE%PSStageLog.txt
if ERRORLEVEL 0 SET ERRORLEV=0
if ERRORLEVEL 1 SET ERRORLEV=1
echo ERRORLEVEL = %ERRORLEV%
exit /B %ERRORLEV%
echo PS Stage Complete
Some pieces of the batch file:
- the /FILE parameter gives the name of the package itself
- /DECRYPT gives the package password if set
- /ConfigFile gives the location of the config file
- /CHECKPOINTING OFF checkpointing will not be used during execution
- the redirect > puts the output log file to the specified location. The logfile name will have the date in the filename (%DATE%) variable
- The last part of the batch file is setting the Error level then propagating that error code out to the exit code of the batch file. This was necessary in our case so that the autosys scheduler program would recognize a failure condition.
2 comments:
Informative...will try this code.
hi Paul , how to run a ssis package using the autosys scheduler. Thx
Post a Comment