0

I have a scenario here: a user A makes changes to a row in database. A column UpdateStatus keeps status of that change for example, it is set to "Edited" from "Not Edited". A second user B knows about the change with the change in value of UpdateStatus column. The first time value of UpdateStatus changes is easily identified and other user is informed about it. How will the further changes to the same row will be known to the other user as the UpdatStatus column will have same value for the new change in this case "Edited".

(Note: other user only clicks to see the notification about the editing to the row. I dont want him to manually set the status of UpdateStatus column as seen or so.)

I am using c# for updating or querying database, using linq queries for my asp.net application.

whisps11
  • 75
  • 12
  • are you open to implement triggers in DB? If yes, then you can add a column in the table or a new table all together to check if the value was updated with timestamp of update – praty Sep 29 '17 at 07:12
  • I guess you're trying to implemt the thing they call 'trail audit'. You can start with this SO post https://stackoverflow.com/questions/17546601/best-way-to-implement-an-audit-trail-in-sql-server and find a approach that fits you best. – unconnected Sep 29 '17 at 07:19
  • 2
    If a change-history is likely to become a requested requirement later, you could consider not modifying the row, but adding a new row with the same ID and a timestamp of creation. A View could filter that table for only the newest versions of the data, but you'd always have the full history. That also allows for "undo" etc. Mind that you'll have to think about deletion. Either delete all versions of that "row" or just mark them "deleted". That way you'd also have the possibility to "undelete" ... – Fildor Sep 29 '17 at 07:22
  • @praty I havent used triggers before therefore I don't know how to use them. Though keeping timestamp for each update gives a probability that it should work. Its a good idea. Thanks a lot. I have got to try it now. – whisps11 Sep 29 '17 at 07:29

0 Answers0