Sp_depends output in a table

sybase

I need to run sp_depends on multiple stored procedures on Sybase to get dependencies. Since I have a lot of stored procedures, I wanted to know if there is any way to force sp_depends output into a temp table and then select from there all dependent objects. If this is possible, I can just run sp_depends from a stored procedure for multiple stored procedures and get the result set in one go.

I tried below without any luck (using Toad):

Insert #test_tbl
exec sp_depends sp_proc

Above gives error as:

"Incorrect syntax near the keyword 'exec'"

Please advise if there is any other efficient way to do this. My goal is to get all dependencies for analysis.

Update:
I do have a way to generate mass 'sp_depends' in excel. Looking for something to run them in one go and get the whole output of supplied objects.
Also, since this is Sybase utility, unfortunately I don't have a way to edit it

Best Answer

A script like this could help you:

isql -Usa -S${ASE_Servername} <<EOF
$password

set nocount on
go
select 'sp_depends '+name from <dbname>..sysobjects
where type='P' and name in ( <list_of_SPs> )
go

EOF