|
database
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
timestamp datatypeHi,
in which cases can we use timestamp datatype? thanks *** Sent via Developersdex http://www.developersdex.com *** It's generally used for keeping track of row modifications. Keep in mind
that it has nothing to do with time or date. It automatically updates itself when a modification occurs: --- CREATE TABLE #MyTable (SomeCol INT, theTimeStamp TIMESTAMP) INSERT #MyTable (SomeCol) VALUES (1) SELECT * FROM #MyTable UPDATE #MyTable SET SomeCol = 2 SELECT * FROM #MyTable DROP TABLE #MyTable --- If your application requires action to be taken when rows are updated, it can be a useful tool. Show quoteHide quote "Ata Giray" <atagi***@yahoo.com> wrote in message news:uevziw0nFHA.2860@TK2MSFTNGP15.phx.gbl... > Hi, > in which cases can we use timestamp datatype? > > thanks > > > *** Sent via Developersdex http://www.developersdex.com *** It is usually used for optimistic concurrency, and if you use it, you should
refer to the data type "ROWVERSION" to avoid ambiguity. This data type does *NOT* have anything to do with date or time (it has a very misleading name). Show quoteHide quote "Ata Giray" <atagi***@yahoo.com> wrote in message news:uevziw0nFHA.2860@TK2MSFTNGP15.phx.gbl... > Hi, > in which cases can we use timestamp datatype? > > thanks > > > *** Sent via Developersdex http://www.developersdex.com *** From BOL:
"timestamp is a data type that exposes automatically generated binary numbers, which are guaranteed to be unique within a database. timestamp is used typically as a mechanism for version-stamping table rows. The storage size is 8 bytes." Generally you can use it in an application for concurrency control. Regards -------------------------------- Mike Epprecht, Microsoft SQL Server MVP Zurich, Switzerland MVP Program: http://www.microsoft.com/mvp Blog: http://www.msmvps.com/epprecht/ Show quoteHide quote "Ata Giray" wrote: > Hi, > in which cases can we use timestamp datatype? > > thanks > > > *** Sent via Developersdex http://www.developersdex.com *** >
Squeezing out more performance!!
Data manipulation problem Update using an Inner Join Either/Or/Any query returning erroneous(?) results SQLDistribution Initialize Error Wildcard Parameters? Performance - Left Outer Joins VS Updates Difference of values from the same column Is this possible with DTS? How to create mdb in sql server |
|||||||||||||||||||||||