Click here to Skip to main content
12,502,578 members (55,258 online)
Click here to Skip to main content
Add your own
alternative version

Stats

8.1K views
4 bookmarked
Posted

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

, 27 Feb 2010 CPOL
Rate this:
Please Sign up or sign in to vote.
Problem : - During project development I got the requirement that I have to modified the column name of the table which is used in the no of procedure i.e i have to found all procedure related to that table and modify it For the above problem following are the solution that i used First ...
Problem : - During project development I got the requirement that I have to modified the column name of the table which is used in the no of procedure i.e i have to found all procedure related to that table and modify it

For the above problem following 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




Second

Shortest way which list out all procedure related to table

select
so.name,
sc.text
from
sysobjects so
inner join syscomments sc on so.id = sc.id
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 very useful when your table field name get change you have to modify the all stored procedure which is using it

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

Share

About the Author

Pranay Rana
Software Developer (Senior) GMind Solusion
India India

Microsoft C# MVP (12-13)


Hey, I am Pranay Rana, working as a ITA in MNC. Web development in Asp.Net with C# and MS sql server are the experience tools that I have had for the past 5.5 years now.

For me def. of programming is : Programming is something that you do once and that get used by multiple for many years

You can visit my blog

StackOverFlow - http://stackoverflow.com/users/314488/pranay
My CV :- http://careers.stackoverflow.com/pranayamr

Awards:



You may also be interested in...

Pro
Pro

Comments and Discussions

 
-- There are no messages in this forum --
| Advertise | Privacy | Terms of Use | Mobile
Web02 | 2.8.160919.1 | Last Updated 27 Feb 2010
Article Copyright 2010 by Pranay Rana
Everything else Copyright © CodeProject, 1999-2016
Layout: fixed | fluid