How to identify which fields are get updated from updated record?,

Hi, I have a record that has been updated recently. Now I want to get a particular field that has been updated in record updation, How will I get the updated field with it's old value (field value before updating)?

Thank you.
more ▼

asked May 21, 2012 at 10:50 AM in Default

Bhu5han gravatar image

4 2 2 3

(comments are locked)
10|1200 characters needed characters left

1 answer: sort voted first

If the update transaction has already happened, then your only way of finding out the old value is to either inspect the transaction logs, or to restore a copy of the data before the modification.

Going forward, you can access the values either by utilising the OUTPUT clause of the update statement, or by using DML triggers and referencing the [inserted and deleted tables][2]

[2]: http://msdn.microsoft.com/en-us/library/ms191300.aspx
more ▼

answered May 21, 2012 at 12:29 PM

Kev Riley gravatar image

Kev Riley ♦♦
54k 47 49 76

(comments are locked)
10|1200 characters needed characters left
Your answer
toggle preview:

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

New code box

There's a new way to format code on the site - the red speech bubble logo will automatically format T-SQL for you. The original code box is still there for XML, etc. More details here.

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here



Answers and Comments

SQL Server Central

Need long-form SQL discussion? SQLserverCentral.com is the place.



asked: May 21, 2012 at 10:50 AM

Seen: 596 times

Last Updated: May 21, 2012 at 02:29 PM