sql-serversql-server-2008sql-insertldf

How can I find information about updating or inserting a sql table row in sql server 2008?


I am looking for information about my table history, I have to know the time that specific row was inserted is there someway to know it? thanks.


Solution

  • Using Triggers

    A Datetime column in that table and an After Insert,Update Trigger which updates that column to GETDATE().

    This will only give you the details about the very last change(update/Insert).

    CDC

    Change Data Capture (CDC) was introduced in SQL Server 2008. Change Data Capture records INSERTs, UPDATEs, and DELETEs applied to SQL Server tables, and makes a record available of what changed, where, and when, in simple relational ‘change tables’.

    These "Change Tables" contain columns that reflect the column structure of the source table you have chosen to track, along with the metadata needed to understand the changes that have been made.

    Read here more about CDC

    Also it is only supported in Datacenter & Enterprise edition.