Groups | Blog | Home
all groups > sql server (alternate) > april 2004 >

sql server (alternate) : TimeStamp


laurenquantrell NO[at]SPAM hotmail.com
4/14/2004 4:15:57 PM
Is there any reason at all to use a timestamp column in a table having
a primarykey column???
Greg D. Moore (Strider)
4/15/2004 3:15:54 AM

[quoted text, click to view]

Except a timestamp as I believe Lauren is referring to doesn't record the
time, just a unique increasing value.

But, to answer Lauren's question, yes. If you have the possibility of more
than one process updating the row at a time.

For example, process A, does a select, notes the timestamp. Proceeds to
manipulate it. (perhaps requires user input, so encapsulating all this in a
transaction is not a good idea.)

Right before performing an update, it begins a transaction, selects the
current timestamp, compares it to what it had from earlier. If it's the
same, it performs the update and commits the transaction. If it's
different, it means someone else has already updated the row. In this case
it rolls back the transaction and informs the user.


[quoted text, click to view]

news.inspire.net.nz
4/15/2004 3:00:03 PM
Yes! A time stamp tells us when something happened!


[quoted text, click to view]


---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.647 / Virus Database: 414 - Release Date: 29/03/2004

AddThis Social Bookmark Button