Quick question Re: Implementation of RowVersion.
I am looking to include it in my next database (Designing it now) and I am pondering 2 different ways:
Anyone tried this? If so what pitfalls or pro's did you experience?
I will be using LINQ to access the data using C# 2008 and SQL Server 2008.
Thanks,
James
rowversion is generally used as a mechanism for version-stamping table rows. The storage size is 8 bytes. The rowversion data type is just an incrementing number and does not preserve a date or a time. To record a date or time, use a datetime2 data type.
SQL Server Change Tracking is a synchronous tracking mechanism, in which the changes information will be available directly once the DML change is committed, without the need for a delay while reading the changes from the Transaction Log file, such as the Change Data Capture asynchronous mechanism.
MySQL TIMESTAMP() FunctionThe TIMESTAMP() function returns a datetime value based on a date or datetime value. Note: If there are specified two arguments with this function, it first adds the second argument to the first, and then returns a datetime value.
If you are using LINQ to SQL then it is a good practice to include a timestamp / rowversion column for each entity table, as this allows LINQ to use optimistic concurrency very easily and results in slightly better performance for updates (as LINQ only has to query the timestamp column and does not have to compare other columns for changes).
So go for the first option. The second option is a non-starter, really.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With