Sybase: get list of stored procedures using a particular table

Ravi picture Ravi · Jun 30, 2010 · Viewed 52.5k times · Source

I have 500 stored procedures in a Sybase database. Using SQL, can I get list of all stored procedures that are using a particular table say tbl_books?

Answer

George Dontas picture George Dontas · Jun 30, 2010

Use something like this:

Select distinct sysobjects.name
, case 
 when sysobjects.type = 'TR' then 'TRIGGER' 
 when sysobjects.type = 'P' then 'PROCEDURE' 
 when sysobjects.type = 'V' then 'VIEW' 
 else 'UNKNOWN' end type
from sysobjects inner join syscomments
on sysobjects.id = syscomments.id
where syscomments.text like '%tbl_books%'