May 10, 2008

Find out all the views in a database using SQL Server 2005

In order to find out all the views in a database, use this query :

USE AdventureWorks
SELECT [name] AS ViewName
,create_date as CreationDate
,modify_date as ModificationDate
FROM sys.views

You can also get various other info like SchemaName from sys.views using the query:

SELECT [name] AS ViewName, SCHEMA_NAME(schema_id) AS SchemaName
FROM sys.views

About The Author

Suprotim Agarwal, ASP.NET Architecture MVP works as an Architect Consultant and provides consultancy on how to design and develop Web applications.

Suprotim is also the founder and primary contributor to DevCurry, DotNetCurry and SQLServerCurry. He has also written an EBook 51 Recipes using jQuery with ASP.NET Controls.

Follow him on twitter @suprotimagarwal

No comments: