What would be the best option to use between the RowVersion and TimeStamp for checking the concurrency type and why?
In most cases, though, the performance difference between the two will be negligible so it would become a preference at this point. But I am always of the mind to go with a better performing solution, no matter how small, when I have a choice...so integer row version fields are always our choice.
Not wishing to be pedantic here but a timestamp data type has nothing to do with date/time - it's just sequential binary number that is incremented by 1 every time a row is inserted or updated in the database - yes the database not the table the row is in. So, every row in the database with a timestamp column will always have a unique number in that column.
Cheers, Peter
You are right, but that was not my point. The performance issue is not with the incrementing of the value...it is if it will be used within queries for any purpose. It isn't a drastic difference, but I have actually set this up and dealt with this recently, so I know that the TimeStamp is slower than the integer if you will be performing any query operation on the WHERE side that includes a >, <, or a between operation.
It is not noticeable unless you are dealing with a larger data set. If you are never going to have a a large database then it really doesn't matter...but I know for a fact that the integer is faster than the time stamp when it relates to queries when dealing with large data sets. If you never do anything but an equal operation on the column then there will not be a noticeable difference whether you are using an integer or a TimeStamp column. But why worry about all of this....if you create a integer row version column then you never have to worry with it regardless....but to each his own I was asked for best practices....and this would fall into that category in my book.
(Which obviously you would want to use a parm, but you get my point)
Versus using an integer value
So anyway that I look at it...it is far easier to deal with an integer...at least in my simple world
Sorry if I gave the impression I was taking issue with your recommendation. Some developers do get into trouble thinking the timestamp is a 'timestamp' when its not - I was just making it clear what that misnamed data type actually is.
I actually went down the path of using timestamp for concurrency but changed to rowversion as a result of this thread: http://forum.strataframe.net/Topic7367-6-1.aspx?