Tuesday, January 10, 2012

How to get list of views names in Sql Database

Below code show you how to get list of views names in selected SQL database.

SQL Code

Select         TABLE_CATALOG,TABLE_NAME
From          INFORMATION_SCHEMA.TABLES
Where        TABLE_TYPE = 'VIEW'
Order by    Table_Name

Try it copy & Paste on SQL Query  analyzer

Code Description
1. From          INFORMATION_SCHEMA.TABLES            -  Table name in SQL master table
2. Select         TABLE_CATALOG,TABLE_NAME               Field name in Information Table
3. Where        TABLE_TYPE = 'VIEW'                                 -  Find Table Type 'VIEW'
4. Order by    Table_Name                                                     -  Order Field by Table name

No comments:

Post a Comment