I didn't expect my original post to generate such discussion! It is unfortunate that Microsoft chose to use the name "Timestamp" for that column type, as it is not at all related to date or time other than the fact that the timestamp can be used to define
chronologically when one row was inserted or updated as opposed to another.
I do a -lot- of SQL programming and my preferred way to check for row concurrancy is to use timestamp. When a row is read for editing, I also return the timestamp, then send it back to the stored procedure which will perform data validation and updating.
I read the row's timestamp and compare it with the timestamp originally read from the row. If it has changed that that means some one or some processes has changed row. I do not want to overwrite those changes so I abort the update transaction and advise
the user to refresh the data and make the changes again.
The timestamp is never used within my UI, so I never need to manipulate it.
Yeah, thats what we figured. Btw, did you find your answer in what the first few posters said? I hope you did :)
And I know what you mean about it being called "timestamp". Like i originaly said, in the documentation, microsoft says to use rowversion instead of timestamp. For -now-, both resolve to the -exact- same thing (its just an alias), but in the future, timestamp's
behavior may change to fit its name better, while rowversion will always be used the same way, so it is suggested to start using the "alias" now, to insure future compatibility.
Jay Meredith
Member
15 Points
3 Posts
Re: SQL Timestamp and ASP.NET
Nov 15, 2006 05:25 PM|LINK
Hi Y'all!
I didn't expect my original post to generate such discussion! It is unfortunate that Microsoft chose to use the name "Timestamp" for that column type, as it is not at all related to date or time other than the fact that the timestamp can be used to define chronologically when one row was inserted or updated as opposed to another.
I do a -lot- of SQL programming and my preferred way to check for row concurrancy is to use timestamp. When a row is read for editing, I also return the timestamp, then send it back to the stored procedure which will perform data validation and updating. I read the row's timestamp and compare it with the timestamp originally read from the row. If it has changed that that means some one or some processes has changed row. I do not want to overwrite those changes so I abort the update transaction and advise the user to refresh the data and make the changes again.
The timestamp is never used within my UI, so I never need to manipulate it.
Regards,
Jay
Jay Meredith
shados
Star
12285 Points
2229 Posts
Re: SQL Timestamp and ASP.NET
Nov 15, 2006 06:24 PM|LINK
Yeah, thats what we figured. Btw, did you find your answer in what the first few posters said? I hope you did :)
And I know what you mean about it being called "timestamp". Like i originaly said, in the documentation, microsoft says to use rowversion instead of timestamp. For -now-, both resolve to the -exact- same thing (its just an alias), but in the future, timestamp's behavior may change to fit its name better, while rowversion will always be used the same way, so it is suggested to start using the "alias" now, to insure future compatibility.
Woil
Member
32 Points
19 Posts
Re: SQL Timestamp and ASP.NET
Aug 01, 2007 08:44 AM|LINK
I've written a tutorial for how to use timestamps with DataSets and the ObjectDataSource that might help with this thread...
http://www.primedigit.com/implementing-optimistic-concurrency-with-sql-timestamps/