1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29
| CREATE PROCEDURE sp_test_transaction
AS
BEGIN TRANSACTION
INSERT INTO DEGRE_URGENCE(du_id,du_libelle) VALUES(1,'kjmlkl')
IF @@ERROR <> 0
BEGIN
ROLLBACK
RAISERROR('error occured while recording purchase', 16, 1)
RETURN 1
END
INSERT INTO DEGRE_URGENCE(du_id,du_libelle) VALUES(2,'kjmlkl')
IF @@ERROR <> 0
BEGIN
ROLLBACK
RAISERROR('error occured while recording purchase', 16, 1)
RETURN 1
END
INSERT INTO DEGRE_URGENCE(du_id,du_libelle) VALUES(6,'kjmlkl')
IF @@ERROR <> 0
BEGIN
ROLLBACK
RAISERROR('error occured while recording purchase', 16, 1)
RETURN 1
END
RETURN 0
COMMIT TRANSACTION
GO |
Partager