I recently had to rebuild our server that houses our RedGate tools. In the process, we upgraded from SQL Compare 9 to 11. I cannot seem to find the option(s) that we had enabled before for error handling.

What are the option(s) to get my script to look like it used to? Thank you in advance.

Before:
IF EXISTS (SELECT * FROM tempdb..sysobjects WHERE id=OBJECT_ID('tempdb..#tmpErrors')) DROP TABLE #tmpErrors
GO
CREATE TABLE #tmpErrors (Error int)
BEGIN TRANSACTION
GO
PRINT N'Statement'
GO
Statement
GO
IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION
GO
IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END
GO
PRINT N'Statement'
GO
Statement
GO
IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION
IF EXISTS (SELECT * FROM #tmpErrors) ROLLBACK TRANSACTION
GO
IF @@TRANCOUNT>0 BEGIN
PRINT 'The database update succeeded'
COMMIT TRANSACTION
END
ELSE PRINT 'The database update failed'
GO
DROP TABLE #tmpErrors
GO

Current:
BEGIN TRANSACTION
IF @@ERROR <> 0 SET NOEXEC ON
GO
Statement
GO
IF @@ERROR <> 0 SET NOEXEC ON
GO
Statement
GO
IF @@ERROR <> 0 SET NOEXEC ON
DECLARE @Success AS BIT
SET @Success = 1
SET NOEXEC OFF
IF (@Success = 1) PRINT 'The database update succeeded'
ELSE BEGIN
	IF @@TRANCOUNT > 0 ROLLBACK TRANSACTION
	PRINT 'The database update failed'
END
GO
jrowles
0

Comments

1 comment

  • Eddie D
    Thank you for your post and sorry for the delayed reply.

    I believe my a colleague has already answered your questions via Support Ticket #30252.

    My colleague informed you of the following:
    Thanks for contacting us.

    The error handling changed from version 9 to version 11, so there aren't any options you can use to get the exact same script as before unfortunately.

    Sorry about the inconvenience.

    Many Thanks
    Eddie
    Eddie D
    0

Add comment

Please sign in to leave a comment.