MS SQL SERVER - controlling transaction (begin, end, rolback, commit)





BEGIN TRAN
UPDATE  [dbo].[Shippers] SET [Phone]='33333' WHERE [ShipperID]=6
IF @@ERROR > 0  
BEGIN
ROLLBACK TRAN
RETURN
END

UPDATE  [dbo].[Shippers] SET [Phone]='444444' WHERE [ShipperID]='A23'
IF @@ERROR > 0  
BEGIN
ROLLBACK TRAN
RETURN
END

COMMIT TRAN 


Yorumlar