Understanding TIMESTAMP (ROWVERSION) in SQL Server
page 4 of 7
by Abhishek Kumar Singh
Average Rating: 
Views (Total / Last 10 Days): 221562/ 693

Using TIMESTAMP with UPDATE command

Similarly, a TIMESTAMP value of row(s) would be automatically updated if we UPDATE any value of row(s) in the table. New TIMESTAMP value will always be the next incremented value of the largest TIMESTAMP value exist among all rows in the table.

For example, Execute following UPDATE command on the table.

Listing 7

UPDATE MyTestTable SET SmallDateTime=0

If you open the table now, the TIMESTAMP column of RowID must have incremented by one to the largest TIMESTAMP available in the table.

Listing 8

RowID       TimeStamp          SmallDateTime           DateTime
----------- ------------------ ----------------------- -----------------------
1           <span class=Bold>0x0000000000000FA3</span> 1900-01-01 00:00:00     2008-09-20 02:26:35.700
2           0x0000000000000FA2 2008-09-20 02:39:00     2008-09-20 02:38:39.763

View Entire Article

User Comments

Title: gfh   
Name: gh
Date: 2012-12-25 1:39:03 AM
Title: abc   
Name: abc
Date: 2012-09-21 4:48:29 AM
Title: nfl jerseys cheap   
Name: NIKE NFL jerseys
Date: 2012-07-02 10:12:14 AM
We are professional jerseys manufacturer from china,wholesal.cheap nike nfl jerseys, mlb jerseys, nhl jerseys,nba jerseys and shoes
,heap jerseys,2012 nike nfl Jerseys,nba jersey and shorts,oklahoma city thunder jersey,official jeremy lin new york knicks jersey,NFL Jerseys Wholesale,blake griffin jersey blue,NFL jerseys For Sale online.All Our Jerseys Are Sewn On and Directly From Chinese Jerseys Factory
,Wholesale cheap jerseys,Cheap mlb jerseys,]Nike NFL Jerseys,Cheap China Wholesae,Wholesale jerseys From China,2012 nike nfl Jerseys,Jerseys From China,,2012 nike nfl Jerseys,Revolution 30 nba jerseys,jersey of nba chicago bulls direk rose ,nfl jerseys,green bay packers jerseys wholesale,Buffalo Bills nike nfl jerseys sale,good supplier soccer jerseys,cool base mlb jerseys,Revolution 30 nba jerseys,2012 stanley cup nhl jersey,
We are professional jerseys manufacturer from china,wholesal.cheap nike nfl jerseys, mlb jerseys, nhl jerseys,nba jerseys and shoes. www.yourjerseyhome.com
Title: 2012 NFL jerseys   
Name: NIKE NFL jerseys
Date: 2012-07-02 10:08:11 AM
[/pre]Cheap NFL,NBA,MLB,NHL
[url=http://www.jersey2shop.com/]cheap jerseys [/url]
[url=http://www.jersey2shop.com/]2012 nike nfl Jerseys[/url]
[url=http://www.jersey2shop.com/]nba jersey and shorts[/url]
[url=http://www.jersey2shop.com/]oklahoma city thunder jersey [/url]
[url=http://www.jersey2shop.com/NFL-Jerseys-c68/]official jeremy lin new york knicks jersey [/url]
[url=http://www.jersey2shop.com/NBA-Jerseys-c77/]NFL Jerseys Wholesale [/url]
NHL Jerseys China
[url=http://www.jersey2shop.com/MLB-Jerseys-c94/]blake griffin jersey blue [/url]NFL jerseys For Sale online.All Our Jerseys Are Sewn On and Directly From Chinese Jerseys Factory
[pre]We Are Professional China jerseys Wholesaler
[url=http://www.cheapjersey2store.com/]Wholesale cheap jerseys[/url]Cheap mlb jerseys
[url= http://www.cheapjersey2store.com/]Nike NFL Jerseys [/url]
[url= http://www.cheapjersey2store.com/ [/url]Cheap China Wholesael[/url]
[url= http://www.cheapjersey2store.com/]Wholesale jerseys From China[/url]
[url=http://www.cheapjersey2store.com/]2012 nike nfl Jerseys[/url]Free Shipping,Cheap Price,7 Days Deliver
We are professional jerseys manufacturer from china,wholesal
sports [url= http://www.cheapjersey2store.com/]Jerseys From China[/url]
[url=http://www.cheapjersey2store.com/NFL-Jerseys-c68]NFL jerseys China[/url]
[url=http://www.cheapjersey2store.com/NHL-Jerseys-c96/]NHL Jerseys China[/url]
[url=http://www.cheapjersey2store.com/NBA-Jerseys-c77/]NBA Jerseys China[/url]
[url=http://www.cheapjersey2store.com/MLB-Jerseys-c94/]MLB Jerseys China[/url]
[url= http://www.cheapjersey2store.com/]China Jerseys[/url],Free Shipping
We are professional jerseys manufacturer from china,wholesal
sports [url= http://www.jerseycaptain.com/]cheap jerseys [/url]
[url= http://www.jerseycaptain.com/]2012 nike nfl Jerseys[/url]
[url=http://www.jerseycaptain.com/NFL-Jerseys-c68] Revolution 30 nba jerseys [/url]
Title: Understanding TIMESTAMP (ROWVERSION) in SQL Server   
Name: Stuart Steedman
Date: 2011-01-26 4:08:12 AM
Thanks, Abhisheck. Good article. I can now see how the timestamp column could be used to reliably filter all new/changed records.

Title: Exact use of timestamp   
Name: Anu
Date: 2010-10-08 7:01:33 AM
please tell me when and why tp use timestamp.. Confused a lot..
Title: Mr   
Name: tv Krishna Kanth
Date: 2010-07-20 7:33:53 AM
To know the latest Timestamp in table you can write a query like "select @@dbts from tblName" .. Yes TimeStamp is datatype which is ofcourse not related to any date & time like data types. here dbtp means data base time stamp you can remember simply with this expansion.. When defining/using a timestamp in a table no need to declare its column name..But the rowversion would ask for the column name eventhough they both are similar in functionality as per my knowledge..
Title: Nonsense   
Name: RIG
Date: 2010-04-23 6:43:30 AM
"Wikipedia.org defines timestamp in very clear manner, as follows:

A timestamp is a sequence of characters, denoting the date and/or time at which a certain event occurred."

Right. But TIMESTAMP in MS SQL Server has nothing to do with date or time.
Title: excellent   
Name: Jeetendra
Date: 2010-04-16 3:52:33 AM
This is Excellent. Thanks.
Title: good   
Name: saravanan
Date: 2010-01-16 2:20:08 AM
good article
Title: timestamp problem   
Name: arpizt
Date: 2009-10-29 9:35:55 PM
"UPDATE table SET field = current_timestamp where (field=1)"
Error msg this field cannot been update.

Title: arpizt@gmail.com   
Name: abhishek
Date: 2009-10-28 6:41:21 PM
arpizt@gmail.com can you post your query here?
Title: timestamp problem   
Name: arpizt@gmail.com
Date: 2009-10-27 5:53:58 AM

I try to run the insert sql, but got this error ("Column or expression 'PaymentDate' cannot be updated." Why? How to overcome this problem?
Title: Abhishek Your Time Stamp Aarticle too good   
Name: Gbbs Mith
Date: 2009-06-13 5:02:18 AM
The article is very good because it was justified clearly time and datetime data type. Hope more such article

Title: Beginner   
Name: nagarajan
Date: 2009-03-17 9:47:06 AM
excellent artice about TIMESTAMP.
Title: good   
Name: Jen
Date: 2008-12-18 4:57:37 AM
good for quick walkthrough.

Community Advice: ASP | SQL | XML | Regular Expressions | Windows

©Copyright 1998-2021 ASPAlliance.com  |  Page Processed at 2021-02-26 10:35:00 PM  AspAlliance Recent Articles RSS Feed
About ASPAlliance | Newsgroups | Advertise | Authors | Email Lists | Feedback | Link To Us | Privacy | Search