Search code examples
stored-proceduressybase

Sybase - Get names of procs calling a given proc


I am looking for a functionality in reverse to sp_depends. sp_depends gives names of objects that the current object is using.

I want to get info in a reverse manner i.e. what all objects(procs in my case) calls the given proc ?

Note

I am using Sybase 12.5


Solution

  • I hope it will help you:

    declare @Proc varchar(30)
    
    select @Proc='ProcName'
    
    select sod.name 
    from sysobjects so
    join sysdepends sd  on sd.id = so.id
    join sysobjects sod on sod.id = sd.depid
    where so.name = @Proc
    and sod.type = 'P'