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

2 Answers 2


A script like this could help you:

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

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

  • This will only print out a list of sp_depends statements, which is at least better than manually typing in the commands, I suppose.
    – Hannah Vernon
    Commented Jan 4, 2017 at 18:40

Unfortunately, the Sybase version of T-SQL does not support INSERT INTO ... EXEC syntax. There appears to be no way to do this directly in T-SQL; you'd need to write a script for it.

Having said that, you may be able to use the code shown in this StackOverflow answer

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.