February 21, 2006 at 2:53 am
Hi guys and gals,
I'm pretty new to DTS so I need to pick your brains...
I whould like to display a custom error message if a step fails. I will be executing the dts package from a stored procedure using the dtsrun utility.
Example:
ActiveX Script Task checking if path "\\servername\foldename" is valid/exists. If the path is valid then continue to export a table, but... if the path is not valid then display an error message "Path '{Path Name}' could not be found!"
Now from within the ActiveX Script Task (VBScript) you can use MsgBox "Path '{Path Name}' could not be found!", and this is fine if you execute the dts package from within Enterprise Manager, but if you run the package using T-SQL (EXECUTE master..xp-cmdshell 'dtsrun /S{ServerName} etc...') it just hangs. How can I display the custom error message? Isn't there some way of calling something like
IF FileFound = 0 Then
ErrorMsg("Folder not found!", 16, "Package Failed!")
EndIf
So that ErrorMsg is sent to the client?
February 21, 2006 at 7:23 am
Try using err.raise.
Ex
err.Raise 16, "DTS Step 1", "Path '{Path Name}' could not be found!"
February 22, 2006 at 5:03 am
It is not hung... it is waiting for your response to the msgbox that is not able to be displayed because it is running in a non-interactive mode.
To put this in simple terms: You told it to go outside and run around, and just ring the doorbell when it needs to come back inside. You told it, you'd be there for it when it got back. You left for for the pub as soon as it went out to go for it's run, and are not there to let it back inside... and you have no intention of ever returning to that house, ever. So, it's not DTS being stupid... you just lied to it, and it's so patient that it will stand there ringing the doorbell forever until it dies. It's a very patient creature! :o)
-Mike Gercevich
Viewing 3 posts - 1 through 2 (of 2 total)
You must be logged in to reply to this topic. Login to reply