Pranay Rana: Find Sp form database which is related to(using) table XXX

Thursday, February 25, 2010

Find Sp form database which is related to(using) table XXX

Problem : - During project devlopment I got the requirement that I have to modified the column name of the table which is used in the no of procdure i.e i have to found all proceudre relatd to that table and modifiy it

For the above problem follwing are the solution that i used

First :
I follow the following step to get list of stored procedure in sql server 2005 management studio

Right click on Table name >> View dependencies

Which list all the procedure and table related to it


Sortest way which list out all procedure related to table

select, sc.text from sysobjects so inner join syscomments sc on = where sc.text like '%ROLES%'-- name of the table and sc.text like '%select%'--found procedure where select * from table name used

Advantage of this :
By the above query i can list out only those stored procedure which is contain select * table name

if i have to list stored procedure which contain update table name than i just have to change my filter condition

The above query is ver usefull when your table field name get change you have to modify the all stored proceudre which is using it

Rate it : -

1 comment: