如果您在SQL 2005上可以尝试:
BEGIN TRANSACTION BEGIN TRY --Run your Statements COMMIT TRANSACTION END TRY BEGIN CATCH ROLLBACK TRANSACTION DECLARE @Msg NVARCHAR(MAX) SELECT @Msg=ERROR_MESSAGE() RAISERROR('Error Occured: %s', 20, 101,@msg) WITH LOG END CATCH
如何打开xact_abort
set xact_abort on