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

CREATE TRIGGER DTULTATULIST_LISTA
ON LISTA
FOR INSERT, UPDATE, DELETE
AS
BEGIN
   IF NOT (0 = (SELECT COUNT(*) FROM INSERTED)) BEGIN
      UPDATE LISTA
      SET DTULTATULIST = GETDATE()
      FROM INSERTED
      WHERE
       ISNULL(LISTA.NRLISTA,0) = ISNULL(INSERTED.NRLISTA,0);
   END;
END;
GO


-- VERSAO --
EXEC ATUVEROBJ 'DTULTATULIST_LISTA','4.11.168';
GO

