Friday, June 15, 2012

TRIGGER

TRIGGER BASIC OPERATION

IF EXISTS (SELECT 1 FROM inserted)

      BEGIN

            IF EXISTS (SELECT 1 FROM deleted)

                  BEGIN

                        SET @action = 'UPDATE';

                  END

            ELSE

                  BEGIN

                        SET @action = 'INSERT';

                  END

      End

ELSE

      BEGIN

            SET @action = 'DELETE';

      END


No comments:

Post a Comment