日期:2014-05-18 浏览次数:20386 次
alter PROCEDURE [dbo].[p_rep_test] as begin declare @ErrorMessage varchar(8000), @ErrorSeverity int, @ErrorState int,@ErrorNumber int, @OperType int,@abc int set @abc=1 BEGIN TRANSACTION update_billofdocumentdetail begin try update t_wh_billofdocument set remark='1234' where id=15127 if @abc=1 begin raiserror('%s',16,1,'中断') return 1 end end try begin catch SELECT @ErrorMessage = ERROR_MESSAGE(), @ErrorSeverity = ERROR_SEVERITY(), @ErrorState = ERROR_STATE(),@ErrorNumber=ERROR_NUMBER() if @ErrorSeverity>18 or @ErrorSeverity<0 set @ErrorSeverity=16 if @ErrorState>127 or @ErrorState<1 set @ErrorState=1 begin try ROLLBACK TRANSACTION update_billofdocumentdetail end try begin catch end catch set @ErrorMessage='保存失败' raiserror (@ErrorMessage, @ErrorSeverity,@ErrorState) return @ErrorNumber end catch begin try COMMIT TRANSACTION update_billofdocumentdetail end try begin catch end catch end