Special Data

Creating and Maintaining Databases

Creating and Maintaining Databases

Special Data

Special data consists of data that does not fit any of the categories of data such as binary data, character data, Unicode data, date and time data, numeric data and monetary data.

Microsoft® SQL Server™ 2000 includes four types of special data:

  • timestamp

    Is used to indicate the sequence of SQL Server activity on a row, represented as an increasing number in a binary format. As a row is modified in a table, the timestamp is updated with the current database timestamp value obtained from the @@DBTS function. timestamp data is not related to the date and time of an insert or change to data. To automatically record times that data modifications take place in a table, use either a datetime or smalldatetime data type to record the events and triggers.

    Note  In SQL Server, rowversion is a synonym for timestamp.

  • bit

    Consists of either a 1 or a 0. Use the bit data type when representing TRUE or FALSE, or YES or NO. For example, a client questionnaire that asks if this is the client's first visit can be stored in a bit column.

  • uniqueidentifier

    Consists of a 16-byte hexadecimal number indicating a globally unique identifier (GUID). The GUID is useful when a row must be unique among many other rows. For example, use the uniqueidentifier data type for a customer identification number column to compile a master company customer list from multiple countries.

  • sql_variant

    A data type that stores values of various SQL Server–supported data types, except text, ntext, timestamp, image, and sql_variant.

  • table

    A special data type used to store a result set for later processing. The table data type can be used only to define local variables of type table or the return value of a user-defined function.

  • user-defined

    Allows a user-defined data type, product_code, for example, that is based on the char data type and defined as two uppercase letters followed by a five-digit supplier number.

See Also

bit

timestamp

uniqueidentifier

Using Data Types

Using Special Data

Using uniqueidentifier Data