D

Information Schema Views Reference

The following views can be used in any database to obtain metadata about database objects. Select from each view as if it were a table in the database, prefixing the view with “INFORMATION_SCHEMA.” as in the following example:

SELECT * FROM INFORMATION_SCHEMA.CHECK_CONSTRAINTS

Information schema views are stored in the Master database. Note that the SysName(256) user-defined data type is equivalent to nVarChar(128).

CHECK_CONSTRAINTS

Column Name Data Type
CONSTRAINT_CATALOG nVarChar(256)
CONSTRAINT_SCHEMA nVarChar(256)
CONSTRAINT_NAME SysName(256)
CHECK_CLAUSE nVarChar(8000)

COLUMN_DOMAIN_USAGE

Column Name Data Type
DOMAIN_CATALOG nVarChar(256)
DOMAIN_SCHEMA nVarChar(256)
DOMAIN_NAME SysName(256)
TABLE_CATALOG nVarChar(256)
TABLE_SCHEMA nVarChar(256)
TABLE_NAME SysName(256)
COLUMN_NAME SysName(256)
DOMAIN_CATALOG nVarChar(256)

COLUMN_PRIVILEGES

Column Name Data Type
GRANTOR nVarChar(256)
GRANTEE nVarChar(256)
TABLE_CATALOG nVarChar(256)
TABLE_SCHEMA nVarChar(256)
TABLE_NAME SysName(256)
COLUMN_NAME SysName(256)
PRIVILEGE_TYPE VarChar(10)
IS_GRANTABLE VarChar(3)

COLUMNS

Column Name Data Type
TABLE_CATALOG nVarChar(256)
TABLE_SCHEMA nVarChar(256)
TABLE_NAME SysName(256)
COLUMN_NAME SysName(256)
ORDINAL_POSITION SmallInt(2)
COLUMN_DEFAULT nVarChar(8000)
IS_NULLABLE VarChar(3)
DATA_TYPE SysName(256)
CHARACTER_MAXIMUM_LENGTH Int(4)
CHARACTER_OCTET_LENGTH

Get Beginning Transact-SQL with SQL Server 2000 and 2005 now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.