February 3, 2003 at 7:14 pm
SQL Server 2000 SP3
Does anyone know of a way to query sysobjects and get a list of only the view names - NOT the table names ..
I tried this :
select id, name from sysobjects where type = 'V' and parent_obj = 0 and category = 0 and xtype = 'V' order by name asc
February 4, 2003 at 3:25 am
xtype = 'v' returns viws only. You are seeing table names too?
Now it will show INFORMATION_SCHEMA views as well and to prevent those just do
where xtype = 'v' and status > 0
February 4, 2003 at 7:12 am
I am still getting table names with xtype= 'V'
February 4, 2003 at 7:43 am
That's extremely odd... I just tested and got what I expected in both master and Northwind: only the views. When you scan sysobjects (no WHERE clause), do the tables show up with xtype and type = 'V' as well?
K. Brian Kelley
http://www.truthsolutions.com/
Author: Start to Finish Guide to SQL Server Performance Monitoring
http://www.netimpress.com/shop/product.asp?ProductID=NI-SQL1
K. Brian Kelley
@kbriankelley
February 4, 2003 at 8:54 am
It worked now..thank you.
Viewing 5 posts - 1 through 4 (of 4 total)
You must be logged in to reply to this topic. Login to reply