0

Im not even sure how to write this out. Would I put the logic in a case when?

select personnum, orgid, eventdate
from dbo.totals
where eventdate = '10-08-2013'

There can be multiple orgids applied to a personnum throughout a day. When there is a change in orgid, I want to return that change.

2
  • Please see my auditing table with triggers response. stackoverflow.com/questions/11890868/… This solution will keep track of an audit trail in xml data format.
    – CRAFTY DBA
    Oct 10, 2013 at 18:40
  • It would be helpful if you added the schema of the table and some sample data. Oct 22, 2013 at 1:08

1 Answer 1

0

It sounds like you want to use a trigger to write to a separate table which contains details of the changes.

You would create an update trigger on the table in question, and use the values in inserted and/or deleted to detail the changes.

1
  • I do not want to update the field though. I simply want to extract the data when a user changes his orgid column. I feel like I don't need to create a table for this. I just want to display what changed. Oct 10, 2013 at 20:39

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.