Re: MUGH-SQLCON How to identify cross-database dependencies?
- Hi Senthil,
You can access the objects across the databases using Linked Server concept. Create linked server and use the syntax like select * from <LSNAME>.dbname.sys.objects . this should work.
RaviFrom: "ramakrishna_e2" <ramakrishna.elashwarapu@...>Sent: Wed, 22 Jun 2011 12:08:11 To: email@example.comSubject: MUGH-SQLCON How to identify cross-database dependencies?
Hi Senthil,Only way you could find dependencies is using SYSCOMMENTS table & sp_depends stored Proc.Please find below article that will give you more info and hope this helps you...http://www.databasejournal.com/features/mssql/article.php/3571026/Finding-Database-Object-Dependencies.htmThanks,Rama--- In firstname.lastname@example.org, Senthil Kumar T R <trsenthilkumar@...> wrote:>> Hello All,> I have this situation:> > I have two databases say "db1" and "db2".> I have a table "tbl1" in the database db1.> I have a SP proc1 in databse db2 that accesses the data from db1.dbo.tbl1> > These are just samples and I have many tables and procdures accessing the objects across the databases.> > > Given this situation, From db1 - Is there an easy way to identify stored procedures of db2 that are depending on the tables of this database?> > Similarly, From db2 - How can I identify the tables of db1 that the procedures of db2 are depending on?> > It looks like I cannot rely on sys.syscomments as it may not be fool-proof/straight forward.> > I tried sp_depends, but that gives the dependencies only within the same database.> > Any ideas?> > Thanks> Senthil T R> > [Non-text portions of this message have been removed]>
[Non-text portions of this message have been removed]