Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- CREATE TRIGGER VerifierStock
- ON commandes
- FOR INSERT
- AS
- BEGIN
- declare @id_stock int,@quantite_commande int
- select @id_stock = id_stock FROM INSERTED
- select @quantite_commande = quantite_commande FROM INSERTED
- IF (SELECT quantite_stocke FROM stock WHERE id_stock = @id_stock) < @quantite_commande
- BEGIN
- RAISERROR('La quantité demandé n est pas disponible pour le stock',16,10)
- Rollback transaction
- END
- END
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement