SQL Server > Data types > TimeStamp
Timestamp in SQL Server is a data type that exposes automatically generated, unique binary numbers within a database.
Example
GO
id int,
code timestamp
);
GO
SELECT
*
FROM
tbl1
Result:
id code
1 0x00000000005C0E69
Timestamp in SQL Server is a data type that exposes automatically generated, unique binary numbers within a database.
- is generally used as a mechanism for version-stamping table rows.
- the storage size is 8 bytes.
- the timestamp data type is just an increment number and does not preserve a date or a time.
- to record a date or time, use a datetime data type.
Example
IF OBJECT_ID(N'tbl1', N'U') IS NOT NULL
DROP TABLE tbl1;GO
CREATE TABLE tbl1
(id int,
code timestamp
);
GO
INSERT INTO tbl1(id) values (1)
*
FROM
tbl1
Result:
id code
1 0x00000000005C0E69