Appendix 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 user-defined data type that is preconfigured and used in instances of SQL Server is functionally equivalent to nvarchar(128).

CHECK_CONSTRAINTS

Returns one row for each CHECK constraint in the current database. This information schema view returns information about the objects to which the current user has permissions.

Column Name

Data Type

CONSTRAINT_CATALOG

nvarchar(128)

CONSTRAINT_SCHEMA

nvarchar(128)

CONSTRAINT_NAME

sysname

CHECK_CLAUSE

nvarchar(4000)

COLUMN_DOMAIN_USAGE

Returns one row for each column in the current database that has an alias data type. This information schema view returns information about the objects to which the current user has permissions.

Column Name

Data Type

DOMAIN_CATALOG

nvarchar(128)

DOMAIN_SCHEMA

nvarchar(128)

DOMAIN_NAME

sysname

TABLE_CATALOG

nvarchar(128)

TABLE_SCHEMA

nvarchar(128)

TABLE_NAME

sysname

COLUMN_NAME

sysname

COLUMN_PRIVILEGES

Returns one row for each column that has a privilege that is either granted to or granted by the current user in the current database.

Column Name

Data Type

GRANTOR

nvarchar(128)

GRANTEE

nvarchar(128)

TABLE_CATALOG

nvarchar(128)

TABLE_SCHEMA

nvarchar(128) ...

Get Beginning T-SQL with Microsoft® SQL Server® 2005 and 2008 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.