find the last modified date of a table

  • Hi,

       How can I find the last modified date of a time in sql server 2000?

    Thanks,

    Sridhar!!

     

  • If you mean the last date and time a table itself was changed, the answer is you cannot, at least with a tool to read the logs and if they have not been trucated since that occurred.

  • By default, you cannot find the date of the most recent change.

    I track the last date of change on a per row basis by adding a datetime column called 'dtchg' to every table for which I need to track modifications. (I also store the user id, but that not relevant here). I then create a INSERT trigger and an UPDATE trigger, each with this code template:

      --

      -- Set last change date to the current system date

      --

      UPDATE <my table>

         SET dtchg = GETDATE()

        FROM <my table>, inserted

       WHERE <my table>.<primary key col1> = inserted.>.<primary key col1>

         [AND <my table>.<primary key col2> = inserted.>.<primary key col2>...]

Viewing 3 posts - 1 through 2 (of 2 total)

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