What is the benefit of using rowversion(timestamp) over LastModifyOn(DateTime) column in a table??
**Problem:** I am working on
asp.net application and my Intention is to confirm that a table row is updating only when it is not updated in between a user's request and submit. **Scenario:** User X and Y open same invoice(invoiceid=12) in different browser User X changed invoice date to 1-july-2014 in UI. User Y changed invoice date to 5-july-2014 in UI User X press submit button.-- Invoice date changed to 1-july-2014 User Y press submit button.-- Invoice date changed to 5-july-2014. X and Y both did not know whether invoice data is altered between request and submit. **Solution-1:** We added a column LastModifyOn(DateTime) in invoice table When retrieve the invoice data for edit also getting LastModifyOn column data Keeping the encrypted LastModifiedOn data in hidden field in UI When user submitting the invoice data changes, we also sending LastModifiedOn to compare. Showing appropriate message. **Solution-2:** We added a column version(rowversion) in invoice table When retrieve the invoice data for edit also getting version column data Keeping the encrypted version data in hidden field in UI When user submitting the invoice data changes, we also sending version to compare. Showing appropriate message. X and Y knows whether invoice data are altered in between or not. **Question:** Now my question is what benefit we will get by using **version(rowversion)** column over **LastModifyOn(DateTime)**... **Point:** We are audit trailing in invoice table so last updated on data is already available. Please mention strong points in reason not like we do not need to update rowversion column explicitly or definition of timestamp ..
Well, one of the advantages of rowversion is that you don't have to explicitly define it in your statatements. The only other real difference is that you have a human readable datetime with the datetime value. Is that necessary for your situation or not? Other than those two distinctions, there really aren't many differences.