Reputation: 2251
I have a batch file which runs three packages. Very simple stuff. Once the package fails, it calls another script which sends an email to inform us. However the packages sometimes fail randomly and then whenever we run the package in visual studio, it works perfectly fine. We are coming up to releasing this and a package which keeps failing isn't acceptable.
Batch file code:
cd C:\Program Files\Microsoft SQL Server\120\DTS\Binn
dtexec.exe /f "\\local\it$\Development\.NET Projects\ReportingTool\DailyUpload_UAT\DailyUpload\DailyUpload_Client.dtsx"
IF ERRORLEVEL 1 powershell -file C:\Users\admin\Documents\SendEmailScript.ps1 -clientid 1
I can pick up the error level and then send an email, but I would like to pick up the actual error message and also send this in the email. I can pass variables in as parameters but I just need to be able to get the actual error message first. Is it possible to do this? I've looked online and I can't find anything on it.
Any help would be greatly appreciated.
Upvotes: 2
Views: 761
Reputation: 699
Unfortunately there is no way of doing so in a batch file, the only way would be to have some sort of logging on the SSIS and maybe log to a table.
Upvotes: 1