A  B  C  D  E  F  G  H  I  J  K  L  M  N  O  P  Q  R  S  T  U  V  W  X  Y  Z  special characters  sybase-tech-blog


Category: ASE: System Tables

spt_values

The spt_values table is a system table of ASE. This table is not documented in the official Sybase documentation. It is mainly used by system stored procedures to translate system internal values and status bits into a human readable format. For example, the stored procedure sp_lock uses the table spt_values to map descriptions for individual lock types. Accordingly, spt_values contains - among others - the string "Ex_table", describing an "exclusive table lock" which again is mapped to system internal values. The table spt_values is created during installation of ASE and never manipulated again, except when upgrading ASE. To learn more about how to use this table, Sybase recommends analyzing its usage from the source code of several system stored procedures, like for example sp_lock. The table spt_values is stored in the master database.

Columns of the spt_values Table

Column: name

The column name is of the datatype varchar. name is the human-readable, textual translation of a system value.

Column: number

The column number is of the datatype int. This column contains the system internal value, the description of which is stored in the column name.

Column: type

The column type is of the datatype char. The column consists of maximum two digit code, identifying a code group. For example, the value "D2" is mapped to the status2 column of the system table sysdatabases and the value "I" decodes an index type (e.g. clustered index.

Column: low

The column low is of the datatype int. It describes the lower boundary of values for code groups with ranges, like configuration options.

Spalte: high

The column high is of the datatype int. It describes the upper boundary of values for code groups with ranges, like configuration options.

A description for the columns ansi_w und msgnum is currently not documented. The primary key of the table combines the columns number and type. Rows containing a value of -1 in column number, describes entries of the corresponding type. For example, the description of type "B" and number "-1" is "YES OR NO":

    select name from spt_values where type = "B" and number = -1
name
----------------------------
YES OR NO

Example for Using the spt_values Table

    select name from master..spt_values
where type = 'W'
order by name asc

Returns all T-SQL key words for the currently used ASE version.