BEGIN TRY BEGIN TRAN IF(@HandleType=1) BEGIN UPDATE table SET ... END ELSE BEGIN UPDATE table SET ... UPDATE table SET ... END COMMIT TRAN END TRY BEGIN CATCH ROLLBACK TRAN RAISERROR(N'更新失败',16,1) END CATCH