SQL事务

DECLARE @SSL_ERR INT,@RP_ERR INT
BEGIN TRANSACTION
UPDATE info SET text='my text' WHERE id=1
SET @SSL_ERR=@@ERROR
UPDATE info SET info='my info' WHERE id=1
SET @RP_ERR=@@ERROR
IF @SSL_ERR=0 AND @RP_ERR=0
COMMIT TRANSACTION
ELSE
ROLLBACK TRANSACTION

 

学习资料:sqlserver事务与回滚

posted @ 2014-05-22 22:25  linyongqin  阅读(92)  评论(0编辑  收藏  举报