Each column that the current user can access in the current database occupies one row in this view. The INFORMATION_SCHEMA.COLUMNS view is based on sysobjects, spt_datatype_info, systypes, syscolumns, syscomments, sysconfigures, and syscharsets.
Each column that the current user can access in the current database occupies one row in this view. The INFORMATION_SCHEMA.COLUMNS view is based on sysobjects, spt_data type_info, policypes, syscolumns, syscomments, sysconfigures, and syscharsets.
Each column that the current user can access in the current database occupies one row in this view. The INFORMATION_SCHEMA.COLUMNS view is based on sysobjects, spt_data type_info, policypes, syscolumns, syscomments, sysconfigures, and syscharsets system tables.
To retrieve information from these views, specify the fully qualified INFORMATION_SCHEMA view_name name.
Column name |
Data Type |
Description |
TABLE_CATALOG |
Nvarchar (128) |
Table qualifier. |
TABLE_SCHEMA |
Nvarchar (128) |
Table owner. |
TABLE_NAME |
Nvarchar (128) |
Table name. |
COLUMN_NAME |
Nvarchar (128) |
Column name. |
ORDINAL_POSITION |
Smallint |
Column ID. |
COLUMN_DEFAULT |
Nvarchar (4000) |
Column default value. |
IS_NULLABLE |
Varchar (3) |
Column is null. If the column allows NULL, YES is returned for this column. Otherwise, NO is returned. |
DATA_TYPE |
Nvarchar (128) |
The data type provided by the system. |
CHARACTER_MAXIMUM_LENGTH |
Smallint |
The maximum length in characters. It is suitable for binary data, character data, or text and image data. Otherwise, NULL is returned. For more information, see data types. |
CHARACTER_OCTET_LENGTH |
Smallint |
The maximum length in bytes. It is suitable for binary data, character data, or text and image data. Otherwise, NULL is returned. |
NUMERIC_PRECISION |
Tinyint |
Precision of approximate numeric data, precise numeric data, integer data, or currency data. Otherwise, NULL is returned. |
NUMERIC_PRECISION_RADIX |
Smallint |
The precision base of approximate numeric data, precise numeric data, integer data, or currency data. Otherwise, NULL is returned. |
NUMERIC_SCALE |
Tinyint |
Number of decimal places in approximate numeric data, precise numeric data, integer data, or currency data. Otherwise, NULL is returned. |
DATETIME_PRECISION |
Smallint |
Child type code for datetime and SQL-92interval data types. For other data types, return NULL. |
CHARACTER_SET_CATALOG |
Varchar (6) |
If the column is of the character data or text data type, the master is returned, indicating the database where the character set is located. Otherwise, NULL is returned. |
CHARACTER_SET_SCHEMA |
Varchar (3) |
If the column is of the character data or text data type, DBO is returned, indicating the name of the character set owner. Otherwise, NULL is returned. |
CHARACTER_SET_NAME |
Nvarchar (128) |
If the column is of the character or text data type, a unique name is returned for the character set. Otherwise, NULL is returned. |
COLLATION_CATALOG |
Varchar (6) |
If the column is of the character or text data type, the master is returned, indicating the database in which the sorting order is defined. Otherwise, this column is NULL. |
COLLATION_SCHEMA |
Varchar (3) |
Return DBO, indicating the owner of the sort order for the character data or text data type. Otherwise, NULL is returned. |
COLLATION_NAME |
Nvarchar (128) |
If the column is of the character or text data type, a unique name is returned for the sorting order. Otherwise, NULL is returned. |
DOMAIN_CATALOG |
Nvarchar (128) |
If a column is a user-defined data type, the column is a database name, and this user-defined data type is created in the database name. Otherwise, NULL is returned. |
DOMAIN_SCHEMA |
Nvarchar (128) |
If a column is a user-defined data type, the column is the creator of the User-Defined data type. Otherwise, NULL is returned. |
DOMAIN_NAME |
Nvarchar (128) |
If a column is a user-defined data type, this column is the name of the user-defined data type. Otherwise, NULL is returned. |