![]() | |
![]() |
| | Thread Tools | Display Modes |
#1
| |||
| |||
|
#2
| |||
| |||
|
|
Hi Here is my store procedure. The below code is not giving error at all when dts fails. Can any one please help me how to trap xp_cmdshell dtsrun error messages CREATE PROCEDURE [dbo].[usp_VRSURVEYComments] AS exec USP_ReadVRUDirectory set nocount on DECLARE @filename Char(20),@cmdstring varchar(150) ,@Error int DECLARE VRUCFileListCursor CURSOR Fast_FORWARD FOR SELECT filelist FROM TBLVRUDir where filelist like 'V%.CMM' order by filelist OPEN VRUCFileListCursor FETCH NEXT FROM VRUCFileListCursor INTO @filename WHILE @@FETCH_STATUS = 0 BEGIN truncate table VRUSURVEYComments set @cmdstring = 'copy e:\ftproot\vru\'+@filename +' e:\ftproot\vru\VRUComments.txt' exec master..xp_cmdshell @cmdstring exec master..xp_cmdshell 'dtsrun /S WPCCP005DS /E /N VRUSurveyComments' SELECT @Error = @@ERROR IF @Error <> 0 BEGIN Print @Error END UPDATE VRUSURVEYComments SET [Filename] = @filename -- where [Filename] is null update VRUSURVEYComments set cur= 'T' exec master..xp_cmdshell 'dtsrun /S WPCCP005DS /E /N VRUSurveyCommentsExport' FETCH NEXT FROM VRUCFileListCursor INTO @filename END CLOSE VRUCFileListCursor DEALLOCATE VRUCFileListCursor |
![]() |
| Thread Tools | |
| Display Modes | |
| |