Sybase Technical Library - Product Manuals Home
[Search Forms] [Previous Section with Hits] [Next Section with Hits] [Clear Search] Expand Search

Money Datatypes [Table of Contents] Date and Time Datatypes

Reference Manual

[-] Chapter 1: System and User-Defined Datatypes
[-] Standards and Compliance
[-] Timestamp Datatype

Timestamp Datatype

Function

Use the user-defined timestamp datatype in tables that are to be browsed in Client-Library(TM) applications (see "Browse Mode" for more information). Adaptive Server updates the timestamp column each time its row is modified. A table can have only one column of timestamp datatype.

Datatype Definition

timestamp is an Adaptive Server-supplied, user-defined datatype that is defined as varbinary(8) NULL. It requires 8 bytes of storage. Because timestamp is a user-defined datatype, you cannot use it to define other user-defined datatypes. You cannot use the aggregate functions sum or avg with the timestamp datatype.

Unlike the SQL standard timestamp datatype, the Transact-SQL timestamp datatype does not hold date and time information, and cannot be converted to a date and time. timestamp holds binary-type data like that shown below:

 timestamp               
------------------
0x0001000000000e51

Creating a timestamp Column

If you create a column named timestamp without specifying a datatype, Adaptive Server defines the column as a timestamp datatype:

    create table testing 
(c1 int, timestamp, c2 int)

You can also explicitly assign the timestamp datatype to a column named timestamp:

    create table testing 
(c1 int, timestamp timestamp, c2 int)

or to a column with another name:

    create table testing 
(c1 int, t_stamp timestamp,c2 int)

You can create a column named timestamp and assign it another datatype (although this could be confusing to other users and would not allow the use of the browse functions in Open Client(TM) or with the tsequal function):

    create table testing 
(c1 int, timestamp datetime)

Standards and Compliance

Standard

Compliance Level

SQL92

The timestamp datatype is a Transact-SQL extension.


Money Datatypes [Table of Contents] Date and Time Datatypes