I have a cursor:Fetch NEXT FROM MY_CURSOR INTO @ServerName While (@@FETCH_STATUS <> -1) BEGIN EXEC ZZ_execRemoteProcedure @ServerName,'ZZ_TicketTransactions',@Parameters,'ZZ_rptTicketsSummary','ZZ_rptTicketsSummary' Fetch NEXT FROM MY_CURSOR INTO @ServerName END CLOSE MY_CURSOR DEALLOCATE MY_CURSOR
I am using an error handling outside. Will this work or i need to put it inside the cursor?IF (@@ERROR <> 0) BEGIN DECLARE @MYERR AS NVARCHAR(MAX) SELECT @MYERR = ERROR_MESSAGE() RAISERROR(@MYERR, 20, 1) RETURN -1 END
Note the cursor is calling another stored procedure and i want to try and catch any server timeout problem.Thanks.