SQL SERVER Query to get all view name exist in database

By

In SQL Server there are so many time situation arise to get all view name  from existing database?
You have two way to get this first one is go to wizard click on database then click on view .Another way is get this from query.I am writing a query to do this.

Code Sample [SQL Server Query]

SELECT * FROM sys.objects where type='v'

Another query is

SELECT * FROM sys.views


For example : if you are use database NorthWind and after that you execute above first one  query then you get all the table name existing in this database & output like below.




Note : All query tested in SQL Server 2008 R2.


If you want to get some specific view name however you remember partially procedure name .Then Query is

SELECT * FROM sys.objects where type='v' and name like '%Invoices%'

read more..

0 comments:

Post a Comment