The following commands will assist in retrieving the metadata details regarding the system-created views.
SELECT * FROM sys.objects WHERE type = ‘V’
Or you can use –
SELECT OBJECT_SCHEMA_NAME(object_id) schema_name, name FROM sys.views;
Querying this table is more convenient. It gives extra attributes on each view that are not available via INFORMATION SCHEMA.VIEWS.
Or if you want to retrieve all the views from a specific database then use the following.
SELECT vw.name FROM INFORMATION_SCHEMA.VIEWS info
JOIN sys.views vw on v.name = info.Table_Name
where info.Table_Catalog = ‘TestDatabase’
Hope you find this article helpful.
One comment