Advertisement
gmendezm

ValidarCantidadMaterialesEnEntregaEsMayorACero

May 28th, 2014
204
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
SQL 0.34 KB | None | 0 0
  1. -- DROP TRIGGER ValidarCantidadMaterialesEnEntregaEsMayorACero
  2. CREATE TRIGGER ValidarCantidadMaterialesEnEntregaEsMayorACero ON entregas FOR INSERT AS
  3.  
  4. DECLARE @cantidad   INT = (SELECT cantidad FROM inserted)
  5.  
  6. IF @cantidad <= 0
  7.             BEGIN
  8.                 ROLLBACK TRAN
  9.                 PRINT 'La cantidad del material entregado debe ser mayor a cero'
  10.             END
  11.         GO
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement