Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
AskSQLTeam
Ask SQLTeam Question
0 Posts |
Posted - 2005-04-27 : 07:56:16
|
| Trudy writes "Difference between timestamp from a DB table & current dateI have a table with timestamp for each entry, I need to find out the elapsed time between timestamp and local time, eastern standard Canada. " |
|
|
mohdowais
Sheikh of Yak Knowledge
1456 Posts |
Posted - 2005-04-27 : 08:18:07
|
| Is it a column of datatype "timestamp" or is it a datetime column that contains the date/time when the record was created, modified, etc.? That's important to know because the timestamp column is stored as a binary internally and I'm not quite sure if it can be converted to a datetime value suitable for comparision (somebody correct me here if I'm wrong). If its a datetime column, its only a matter of using DATEDIFF (and applying an offset if your local time is different from the local time on the sql server)OS |
 |
|
|
mpetanovitch
Yak Posting Veteran
52 Posts |
Posted - 2005-04-27 : 14:51:37
|
Timestamp is a data type that exposes automatically generated binary numbers, which are guaranteed to be unique within a database.Timestamp data is not related to the date and time of an insert or change to data.MS wants us to use the datatype called rowversion as its a better description of what it is. All that timestamp/rowversion will get you is a unique id when the row was updated/inserted.Example of usage:Optimastic concurrency.Data Warehouse loads.Basically they compare an old record to the existing, if there is a difference in the timestamp/rowversion column, then they know the row as been modified. Nothing to do with the actual time. Brought to you by:BlackShoe ProductionsMike Petanovitch |
 |
|
|
|
|
|