Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Getting information on dependent objects from another database

Status
Not open for further replies.

micha123

Programmer
Jul 5, 2005
189
CA
Ho do I get information on dependent objects from another database?
Thanks.

"A long life is when each day is full and every hour wide!"
(A Jewish Mentor)
M. [hourglass]

 
I assume you mean dependent objects in another Sybase DB on the same server..., right?

If so, you'll need to change DB contexts:

use [dbname]
go
sp_depends ....

Alternatively, you could inquire against sysdepends directly. You'll have to convert the id and depid values to their names via explicit joins to sysobjects because object_name() will return the value (if any) for the DB you're "in".

Another option that I think will work is to create a stored procedure in each of the DB's that invokes sp_depends and then you can call that by qualifying it's name. Here's how you might do it:

create proc do_sp_depends ( @object_name varchar( 30 ) )
as
execute sp_depends @object_name
go

Then instead of using sp_depends, you could do a qualified execution of the do_sp_depends procedure:

execute dbname..do_sp_depends table_name

If none of those do it for you, go ahead and reply. I'll monitor this post.

Good luck with it!

John
Alpha-G Consulting, LLC
 
One thing that wasn't entirely clear, perhaps is that you have to do the create procedure in every DB of interest.

John
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top