存储过程错误事物回滚
SET XACT_ABORT ON SET NOCOUNT ON SET TRANSACTION ISOLATION LEVEL REPEATABLE READ DECLARE @intTranCount INT SET @intTranCount=@@TranCount IF @intTranCount<> 0 SAVE TRANSACTION Savepoint ELSE BEGIN TRANSACTION --错误提示-- BEGIN RAISERROR('存在重复的教师账号,请先把原账号停用后新增!',16,1) GOTO ErrHandle END --完成-- IF @intTranCount<>@@TranCount COMMIT TRANSACTION RETURN ErrHandle: IF @intTranCount=@@TranCount BEGIN ROLLBACK TRANSACTION Savepoint RETURN END ELSE BEGIN ROLLBACK TRANSACTION RETURN END