views:

188

answers:

3

Hi,

I have 500 store procedures in a sysbase database. Using sql, can i get list of all stored procedures that are using a particular table say "tbl_books"

Thanks

A: 

How about something along the lines of:

select proc_name from sysprocedures where proc_defn like "%tbl_books%"
ennuikiller
sorry, i do not see coulmns proc_name and proc_defn in table sysprocedures;; select top 5 * from sysprocedures type id sequence status number version ----------- ----------- ----------- ----------- ----------- ----------- 2 3031 0 1026 0 12500 2 3031 1 1026 0 12500 2 3031 2 1026 0 12500 2 3031 3 1026 0 12500 2 3031 4 1026 0 12500
Ravi
A: 

Initially I'd try sp_depends.

Syntax: sp_depends objname[, column_name]

For objname you can supply any object name, eg table, view or sproc.

AdamH
+1  A: 

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%'
gd047
Thanks. It works.
Ravi