Find List of Columns Updated inside Trigger

  • BINU PRASAD.M

    SSC Enthusiast

    Points: 120

    Comments posted to this topic are about the item Find List of Columns Updated inside Trigger

  • Matt Wright

    SSC Enthusiast

    Points: 162

    The only thing I don't like about this at first glance is there is no check to see if the data actually changed. So if I issue the statement...

    UPDATE Users

    SET user_name = user_name

    WHERE user_id = 'Fred1234';

    ...then the code fragment supplied will say the column was updated, when in fact nothing changed.



    I am Melvis.

  • facemann

    Right there with Babe

    Points: 787

    I agree Matt. This is what I use in my triggers to see if a change has actually occurred.

    IF EXISTS (SELECT *

    FROM

    INSERTED I JOIN DELETED D ON I.Key = D.Key

    WHERE

    I.Col <> D.Col)

  • akljfhnlaflkj

    SSC Guru

    Points: 76202

    Thanks for the script.

  • Lynn Pettis

    SSC Guru

    Points: 442167

    Iwas Bornready (5/10/2016)


    Thanks for the script.

    What script? Looks to me like you are just trying to increase your post count.

Viewing 5 posts - 1 through 5 (of 5 total)

You must be logged in to reply to this topic. Login to reply