View names only

  • 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

  • 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

  • I am still getting table names with xtype= 'V'

  • 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

  • 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