IF EXISTS(SELECT * FROM sysobjects O, sysusers U
          WHERE
            o.name = 'DTULTATU_ALIQTEMP' and
            type = 'TR'                  and
            u.uid = o.uid                and
            u.name = USER)
   DROP TRIGGER DTULTATU_ALIQTEMP
GO

CREATE TRIGGER DTULTATU_ALIQTEMP
ON ALIQTEMP
FOR INSERT, UPDATE
AS
BEGIN
   IF NOT (0 = (SELECT COUNT(*) FROM INSERTED)) BEGIN
      UPDATE ALIQTEMP
      SET DTULTATUALIQTMP = GETDATE()
      FROM INSERTED
      WHERE (ISNULL(ALIQTEMP.NRALIQTEMP,0) = ISNULL(INSERTED.NRALIQTEMP,0))   AND
            (ISNULL(ALIQTEMP.NRSEQUALIQ,0) = ISNULL(INSERTED.NRSEQUALIQ,0));
   END;
END;
GO

-- VERSAO --
EXEC ATUVEROBJ 'ATUALIZA_DADOS_DTPROCESSA','5.03.009';
GO
