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 2005 Forums
 Transact-SQL (2005)
 finding dependencies on other database

Author  Topic 

sanjnep
Posting Yak Master

191 Posts

Posted - 2007-05-01 : 16:49:09
Is there any thing we can do to find the dependents objects outside the current database. sp_depends works only for objects for current database. I am asking because I have tables on one database and views on another database and I want to find dependencies of the views with tables on other database.
Thanks

pbguy
Constraint Violating Yak Guru

319 Posts

Posted - 2007-05-02 : 03:51:22
add different database name prefix to the table name and two dots for example (master..sysobjects)

select distinct (select name from sysobjects where id = sd.id) as 'Name',
case (select xtype from sysobjects where id = sd.id)
when 'P' then 'Stored Procedure'
when 'TR' then 'Trigger'
when 'V' then 'View' end as 'Type' from sysdepends sd, sysobjects so where sd.depid = so.id and
so.name = 'fini_deal_buyer' order by name
Go to Top of Page
   

- Advertisement -