CREATE TRIGGER [dbo].[EST_PROD_EST_SNGPC_LOTE_CPL_VALOR_ZERADO] ON [dbo].[EST_PROD_EST_SNGPC_LOTE_CPL]
WITH EXECUTE AS CALLER
FOR INSERT, UPDATE
AS
BEGIN
DECLARE @QT_LOTE INT; 
 SELECT
   @QT_LOTE =  QT_LOTE
  FROM INSERTED
  IF @QT_LOTE < 0 
  BEGIN
     ROLLBACK TRANSACTION
     RAISERROR('[SNGPC LOTES] OPERAÇÃO CANCELADA IMPOSSIVEL INSERIR VALOR NEGATIVO  !', 15, 1)
  END
END
GO