I have a simple SQL job that is scheduled to invoke a .cmd to perform a
file copy task.
How can I get SQL job to report to correct status when the copy task
fails, such as due to connectivity issue, or file not found, and etc?
thanks.One option is to capture the return code and do a raiserror
if the return code <> 0. Along the lines of:
DECLARE @.ret int
EXEC @.ret = master..xp_cmdshell 'copy ...etc' , NO_OUTPUT
IF @.ret <> 0 RAISERROR('File copy error',16, 1)
-Sue
On 28 Jul 2006 08:23:49 -0700, "Rose" <rose.say@.gmail.com>
wrote:
>I have a simple SQL job that is scheduled to invoke a .cmd to perform a
>file copy task.
>How can I get SQL job to report to correct status when the copy task
>fails, such as due to connectivity issue, or file not found, and etc?
>thanks.
Showing posts with label invoking. Show all posts
Showing posts with label invoking. Show all posts
Wednesday, March 21, 2012
Question on SQL job step invoking .cmd
I have a simple SQL job that is scheduled to invoke a .cmd to perform a
file copy task.
How can I get SQL job to report to correct status when the copy task
fails, such as due to connectivity issue, or file not found, and etc?
thanks.One option is to capture the return code and do a raiserror
if the return code <> 0. Along the lines of:
DECLARE @.ret int
EXEC @.ret = master..xp_cmdshell 'copy ...etc' , NO_OUTPUT
IF @.ret <> 0 RAISERROR('File copy error',16, 1)
-Sue
On 28 Jul 2006 08:23:49 -0700, "Rose" <rose.say@.gmail.com>
wrote:
>I have a simple SQL job that is scheduled to invoke a .cmd to perform a
>file copy task.
>How can I get SQL job to report to correct status when the copy task
>fails, such as due to connectivity issue, or file not found, and etc?
>thanks.sql
file copy task.
How can I get SQL job to report to correct status when the copy task
fails, such as due to connectivity issue, or file not found, and etc?
thanks.One option is to capture the return code and do a raiserror
if the return code <> 0. Along the lines of:
DECLARE @.ret int
EXEC @.ret = master..xp_cmdshell 'copy ...etc' , NO_OUTPUT
IF @.ret <> 0 RAISERROR('File copy error',16, 1)
-Sue
On 28 Jul 2006 08:23:49 -0700, "Rose" <rose.say@.gmail.com>
wrote:
>I have a simple SQL job that is scheduled to invoke a .cmd to perform a
>file copy task.
>How can I get SQL job to report to correct status when the copy task
>fails, such as due to connectivity issue, or file not found, and etc?
>thanks.sql
Subscribe to:
Posts (Atom)