actual date each insert /update operation that is performed on a table

  • I need to add a column in my table that would able to tell me the actual date each insert or update operation that is performed on a table. I tired out timestamp but it give me tracks a relative time within a database, not an actual time that can be associated with a clock. Any idea !!!

  • use a datetime or smalldatetime column with GetDate() as the default value

  • +1

    Create a "updatedDateTime" with DATETIME type, with default GETDATE() (or GETUTCDATE())

    Timestamp is a binary type to track of changes, confusing name yes

    SQLServerNewbieMCITP: Database Administrator SQL Server 2005
  • Keep in mind that tracking the last time something was updated is only good for knowing if the row has been refreshed recently. It doesn't tell you how often it's been updated, nor how frequently, just how recently.

    If that's what you need, then a column for "LastUpdated" can do that, and you can either add that to your update procs, or set up a trigger to keep it up-to-date.

    Generally, if I need data like that, I prefer to log the changes, so you can track frequency, number of updates, who updated what, and what was updated.

    - Gus "GSquared", RSVP, OODA, MAP, NMVP, FAQ, SAT, SQL, DNA, RNA, UOI, IOU, AM, PM, AD, BC, BCE, USA, UN, CF, ROFL, LOL, ETC
    Property of The Thread

    "Nobody knows the age of the human race, but everyone agrees it's old enough to know better." - Anon

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

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