VIEWS (Transact-SQL)
SQL Server 2008 Books Online (October 2009)
VIEWS (Transact-SQL)

Returns one row for views that can be accessed by the current user in the current database.

To retrieve information from these views, specify the fully qualified name of INFORMATION_SCHEMA.view_name.

Column name Data type Description

TABLE_CATALOG

nvarchar(128)

View qualifier.

TABLE_SCHEMA

nvarchar(128)

Name of schema that contains the view.

ms181381.note(en-us,SQL.100).gifImportant:
Do not use INFORMATION_SCHEMA views to determine the schema of an object. The only reliable way to find the schema of an object is to query the sys.objects catalog view or use the OBJECT_SCHEMA_NAME function.

TABLE_NAME

nvarchar(128)

View name.

VIEW_DEFINITION

nvarchar(4000)

Returns the first 4000 characters of the definition text of the view if the view is not encrypted. Otherwise, returns NULL.

To ensure that you obtain the complete definition, query the OBJECT_DEFINITION function or the definition column in the sys.sql_modules catalog view.

CHECK_OPTION

varchar(7)

Type of WITH CHECK OPTION. Is CASCADE if the original view was created by using the WITH CHECK OPTION. Otherwise, NONE is returned.

IS_UPDATABLE

varchar(2)

Specifies whether the view is updatable. Always returns NO.

Examples

The following example returns each view name and the first 4000 characters of the view definition.

USE AdventureWorks;
GO

SELECT TABLE_SCHEMA, TABLE_NAME,
       VIEW_DEFINITION AS [First 4000 characters]
FROM INFORMATION_SCHEMA.VIEWS;
See Also

Reference

System Views (Transact-SQL)
Information Schema Views (Transact-SQL)
sys.sql_modules (Transact-SQL)
sys.views (Transact-SQL)
OBJECT_SCHEMA_NAME (Transact-SQL)

Other Resources

Querying the SQL Server System Catalog

Help and Information

Getting SQL Server 2008 Assistance
© 2009 Microsoft Corporation. All rights reserved.   Terms of Use | Trademarks | Privacy Statement
Page view tracker
Rate the Lightweight library
x
Lightweight builds on ScriptFree (loband) by adding features you've requested: a SearchBox and default code language selection.
Do you like the SearchBox?
Do you like the tabbed code blocks?
How useful is this topic?
Tell us more.
Thanks
x
You're helping to improve MSDN Online.
Feedback
Switch View
Classic
Lightweight Beta
ScriptFree
Switch View