Error Handling
jrowles
Posts: 2
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:
Current:
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
Comments
I believe my a colleague has already answered your questions via Support Ticket #30252.
My colleague informed you of the following:
Many Thanks
Eddie
Senior Product Support Engineer
Redgate Software Ltd
Email: support@red-gate.com