Using SQL Server 2005 Standard Edition.
Microsoft SQL Server 2005 - 9.00.1399.06 (Intel X86) Oct 14 2005 00:33:37 Copyright (c) 1988-2005 Microsoft Corporation Standard Edition on Windows NT 5.2 (Build 3790: Service Pack 1)
I'm using xp_cmdshell in a stored procedure to copy a file. I purposely changed the file location and UNC path so that the file would not be found. I get this message in the proc output: The system cannot find the file specified. However, return code returns 0 and not 1 as I expected.
Does anyone know what I am doing wrong?
Thanks.
Microsoft SQL Server 2005 - 9.00.1399.06 (Intel X86) Oct 14 2005 00:33:37 Copyright (c) 1988-2005 Microsoft Corporation Standard Edition on Windows NT 5.2 (Build 3790: Service Pack 1)
I'm using xp_cmdshell in a stored procedure to copy a file. I purposely changed the file location and UNC path so that the file would not be found. I get this message in the proc output: The system cannot find the file specified. However, return code returns 0 and not 1 as I expected.
Does anyone know what I am doing wrong?
Thanks.
Code:
Exec @rc = sp_executesql @statement
If (@rc = 1)
Begin
RAISERROR ('IMS Copy Failure: %s.',
16, 1, @statement)
End