Results 1 to 6 of 6
  1. #1
    Join Date
    Jun 2008
    Posts
    2

    Unanswered: is there a way to check if a row in table has been modified

    is there a way to check if a row in table has been modified

    Like is there some checksum value u can add to a new column on a table

  2. #2
    Join Date
    Feb 2004
    Location
    One Flump in One Place
    Posts
    14,912
    Do you have the checksum for before the modification? Short answer is "no - not retrospectively" - you would need to implement some sort of auditing. You could restore from another point in time if this is one off and urgent and compare.

  3. #3
    Join Date
    Jun 2003
    Location
    Ohio
    Posts
    12,592
    Provided Answers: 1
    You could add a datetime stamp to your table with a trigger that updates it on any modification. I typically also add a column to record the spid details of who make the modification.
    If it's not practically useful, then it's practically useless.

    blindman
    www.chess.com: "sqlblindman"
    www.LobsterShot.blogspot.com

  4. #4
    Join Date
    Jun 2008
    Posts
    19
    Additionally, if you wanted to audit some more details you can take the trigger concept and write the before and/or after values to a separate table with the datetime stamp and username by referencing the Inserted temporary table related to your table. Every time records are inserted/updated in a table you can use them before they are committed by referencing "Inserted" in a select statement fired by a trigger. Search for Inserted in SQL Server 2005 Books Online for more info...

  5. #5
    Join Date
    Jul 2003
    Location
    San Antonio, TX
    Posts
    3,662
    ...and if your app uses stored procedures to perform the update, you can also use OUTPUT clause on your UPDATE statements to redirect pre- and post-modified data to an audit table, without having to create a trigger for it.
    "The data in a record depends on the Key to the record, the Whole Key, and
    nothing but the Key, so help me Codd."

  6. #6
    Join Date
    Jun 2005
    Posts
    319
    Quote Originally Posted by newphone
    is there a way to check if a row in table has been modified

    Like is there some checksum value u can add to a new column on a table
    Use rowversion:
    http://msdn.microsoft.com/en-us/libr...(SQL.100).aspx

    It auto-increments for you

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •