— Select views that don’t reference other views.



,       v.[name]

from    sys.views v

join    sys.schemas s on v.schema_id = s.schema_id

where   v.object_id not
in (

    select distinct


    from        sys.dm_sql_referenced_entities (s.[name] + ‘.’ + v.[name], ‘OBJECT’) r

    join        sys.objects o on r.referenced_id = o.object_id

    where       o.[type] = ‘V’


order by    s.[name], v.[name]



Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Related Posts