Determining the Updated Columns

  • Comments posted to this topic are about the item Determining the Updated Columns

  • IF UPDATE(CreditLimit)

    That approach seems preferable to me, unless you really have to use COLUMNS_UPDATED()

    SQL DBA,SQL Server MVP(07, 08, 09) "It's a dog-eat-dog world, and I'm wearing Milk-Bone underwear." "Norm", on "Cheers". Also from "Cheers", from "Carla": "You need to know 3 things about Tortelli men: Tortelli men draw women like flies; Tortelli men treat women like flies; Tortelli men's brains are in their flies".

  • All depends on the use case. One might work better than the other, or one might not work

  • COLUMNS_UPDATED() will tell you which columns had an update attempted but it will not tell you if a value actually changed.

    Also, I'm in favor of the clarity of  IF UPDATED(CreditLimit) like Scott pointed out.  I'd also add code to compare the values of the INSERTED and DELETED values on this column to determine if the was really a value change or not.

    And Welcome Back!!!

    --Jeff Moden


    RBAR is pronounced "ree-bar" and is a "Modenism" for Row-By-Agonizing-Row.
    First step towards the paradigm shift of writing Set Based code:
    ________Stop thinking about what you want to do to a ROW... think, instead, of what you want to do to a COLUMN.

    Change is inevitable... Change for the better is not.


    Helpful Links:
    How to post code problems
    How to Post Performance Problems
    Create a Tally Function (fnTally)

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

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