I have a TSQL script that does a lot of database structure adjustments but it\'s not really safe to just let it go through when something fails.
to make things clear:
SET XACT_ABORT ON BEGIN TRAN -- Batch 1 GO if @@TRANCOUNT = 0 SET NOEXEC ON; GO -- Batch 2 GO if @@TRANCOUNT = 0 SET NOEXEC ON; GO -- Batch 3 GO if @@TRANCOUNT > 0 COMMIT GO