What the difference between timestamp and current_timestamp with MS SQL Server
Timestamp
- Timestamp is a 8 bytes sequential Hex number, that has nothing to do with neither the date nor the time.
- To get the current value of timestamp, use: @@DBTS.
- It is a unique value per database.
- Most often used for versioning to keep track of changes to a row.
USE sql911;
go
SELECT @@DBTS AS 'Timestamp current value';
go
go
SELECT @@DBTS AS 'Timestamp current value';
go
Timestamp current value ----------------------- 0x00000000000007D0 (1 row(s) affected)
- Timestamp is a 8 bytes Hex number.
- It is a unique value per database. This mean that the same timestamp value can be assigned to another database.
Current_timestamp
SELECT CURRENT_TIMESTAMP AS 'Today', GETDATE() AS 'Also Today';
go
go
Today Also Today ----------------------- ----------------------- 2007-07-04 18:32:14.530 2007-07-04 18:32:14.530 (1 row(s) affected)
- CURRENT_TIMESTAMP: Returns the same current date and time as GETDATE().
- CURRENT_TIMESTAMP: is the ANSI SQL equivalent to GETDATE().
- Try to use CURRENT_TIMESTAMP instead of GETDATE().

