Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 SQL Server Development (2000)
 Getting Table Names from Views

Author  Topic 

jasraja
Starting Member

22 Posts

Posted - 2007-03-01 : 11:16:39
Hi All,

I have an ad-hoc requirement of extracting Table Names from all the views in my database. I have 100 plus views in my database and each has an average of five tables upon which the view is built.

Is there any system procedure or inbuilt function then takes a list of all the views in the database and fetches me back with the list of views and associated tables.

Thanks in Advance!!!
Jaspreet

snSQL
Master Smack Fu Yak Hacker

1837 Posts

Posted - 2007-03-01 : 11:26:18
Try this
select distinct object_name(sysdepends.id) as [View]
, object_name(depid) as [Table]
from sysdepends
inner join sysobjects on sysdepends.id = sysobjects.id
where sysobjects.type = 'V'
order by [View], [Table]
Go to Top of Page

jasraja
Starting Member

22 Posts

Posted - 2007-03-02 : 09:21:34
Thanks Mate...
You saved a lot of my time!!!!

Thanks again :)
Go to Top of Page
   

- Advertisement -