Returns information about the data types supported by the current environment.
DBMS-dependent data type.
Code for the ODBC type to which all columns of this type are mapped.
Maximum precision of the data type on the data source. NULL is returned for data types for which precision is not applicable. The return value for the PRECISION column is in base 10.
Character or characters used before a constant. For example, a single quotation mark (') for character types and 0x for binary.
Character or characters used to terminate a constant. For example, a single quotation mark (') for character types and no quotation marks for binary.
Description of the creation parameters for this data type. For example, decimal is "precision, scale", float is NULL, and varchar is "max_length".
1 = Allows null values.
0 = Does not allow null values.
Specifies case sensitivity.
1 = All columns of this type are case-sensitive (for collations).
0 = All columns of this type are case-insensitive.
Specifies the search capability of the column type:
1 = Cannot be searched.
2 = Searchable with LIKE.
3 = Searchable with WHERE.
4 = Searchable with WHERE or LIKE.
Specifies the sign of the data type.
1 = Data type unsigned.
0 = Data type signed.
Specifies the money data type.
1 = money data type.
0 = Not a money data type.
1 = Autoincrementing.
0 = Not autoincrementing.
NULL = Attribute not applicable.
An application can insert values into a column that has this attribute, but the application cannot update the values in the column. With the exception of the bit data type, AUTO_INCREMENT is valid only for data types that belong to the Exact Numeric and Approximate Numeric data type categories.
Localized version of the data source-dependent name of the data type. For example, DECIMAL is DECIMALE in French. NULL is returned if a localized name is not supported by the data source.
Minimum scale of the data type on the data source. If a data type has a fixed scale, the MINIMUM_SCALE and MAXIMUM_SCALE columns both contain this value. NULL is returned where scale is not applicable.
Maximum scale of the data type on the data source. If the maximum scale is not defined separately on the data source, but is instead defined to be the same as the maximum precision, this column contains the same value as the PRECISION column.
Value of the SQL data type as it appears in the TYPE field of the descriptor. This column is the same as the DATA_TYPE column, except for the datetime and ANSI interval data types. This field always returns a value.
datetime or ANSI interval subcode if the value of SQL_DATA_TYPE is SQL_DATETIME or SQL_INTERVAL. For data types other than datetime and ANSI interval, this field is NULL.
Number of bits or digits for calculating the maximum number that a column can hold. If the data type is an approximate numeric data type, this column contains the value 2 to indicate several bits. For exact numeric types, this column contains the value 10 to indicate several decimal digits. Otherwise, this column is NULL. By combining the precision with radix, the application can calculate the maximum number that the column can hold.
Value of interval leading precision if data_type is interval; otherwise NULL.
usertype value from the systypes table.
The following example retrieves information for the sysname and nvarchar data types by specifying the data_type value of -9.
USE master; GO EXEC sp_datatype_info -9; GO