Search tables in which there were changes

  • Good day. Tell me how to calculate the tables in which, for example, there is a record for the last 20-30 minutes? The database consists of tables, functions, triggers, and ensures that itd program for the design of complex and large objects, such as plants.

  • gurbanov.1984 (7/15/2014)


    Good day. Tell me how to calculate the tables in which, for example, there is a record for the last 20-30 minutes? The database consists of tables, functions, triggers, and ensures that itd program for the design of complex and large objects, such as plants.

    The "best" way (IMHO) is to have a properly maintained/populated ModifiedDate column as a DATETIME data-type. Other than that and provided that the tables have clustered indexes, you could check sys.dm_db_index_usage_stats and get the last dates/times out of that. In particular, the "user_updates" column from that view is defined in BOL as...

    The user_updates counter indicates the level of maintenance on the index caused by insert, update, or delete operations on the underlying table or view.

    ... so keep in mind that it would be just new rows from INSERTs.

    --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 2 posts - 1 through 1 (of 1 total)

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