1. is it use in real world application?
2. what is it for?
now i'm doing the SELECT CAST(@@DBTS AS datetime) and the result is 1900-01-01 00:00:07.053, the value just not make sense to me
thx
Printable View
1. is it use in real world application?
2. what is it for?
now i'm doing the SELECT CAST(@@DBTS AS datetime) and the result is 1900-01-01 00:00:07.053, the value just not make sense to me
thx
timestamp (for example from @@DBTS) is guaranteed to be unique in database (wheras GetDate() not). It has "rowversion" alias which better describe its usage. It is a "mark" that U can use to indicate that row has changed.
So timestamp can be used in manual optimistic row locking or in merge operation. Casting timestamp to datetime has no sense (it is more like GUID but with database scope).
Best regards,
Krzemo.
thanks Krzemo
as far as i understand that every time we update the database that have timestamp value, it'll automatic update the timestamp field too..
by using the select @@DBTS it's only shown the binary value..is it possible to know which row from which table that has changed? how?Quote:
It is a "mark" that U can use to indicate that row has changed.
coz i'm not sure how to read the 'real' value that represented by those binary (if it's possible) :blush:Quote:
Casting timestamp to datetime has no sense (it is more like GUID but with database scope).
PS : sorry, new to MS SQL
thanks
Yes.Quote:
as far as i understand that every time we update the database that have timestamp value, it'll automatic update the timestamp field too..
No it is auto-generated binary value. But it doesn't matter - U have to find if data has changed or not so U only check if it is equal to that U read before (if not than data has changed for sure).Quote:
by using the select @@DBTS it's only shown the binary value..is it possible to know which row from which table that has changed?
What for?Quote:
coz i'm not sure how to read the 'real' value that represented by those binary (if it's possible)
Don't mix timestamp with "SQL-92 timestamp" datatype.
The "SQL-92 timestamp" datatype is equal to "DATETIME" in SQL Server.
In new SQL Server releases timestamp will be renamed to "rowversion" and "DATETIME" will be renamed to timestamp (to ensure standards) so if U want 2 use timestamp use "rowversion" alias instead (to prevent confusion when U upgrade server)
Hope that helps.
Read this from SQL BOL and try to chang from using timestamp to rowversion so when they change the funtion in the future it will not impact you.
http://msdn.microsoft.com/library/de...ta-tz_6fn4.asp
thanks Krzemo and antares686
to compare which value is the latest one..but it already been answered by u..Quote:
What for?
thanks for the tip from both of u
sorry to bother again
how can i get rowversion datatype? can't seem to find it anywhere since from what i read rowversion datatype is used from MSSQL 2000 upQuote:
In new SQL Server releases timestamp will be renamed to "rowversion" and "DATETIME" will be renamed to timestamp..
thanks