To Look for a table used in one/mutliple stored procedures

Many of the times, i personally came through situations in which due to some changes in table layout, i need to change the stored procedures using the table. The big question is How Fastly ?? I will write one small SQL query to list all stored procedures using the table and my problem is solved.

Dear Friends,
Many of the times, It happens that due to some changes in SQL tables layout(design), we need to make changes in stored procedures using the table. So the biggest question is not How but how fast ?

To find out a list of stored procedures using the table, follow the steps:
1. Open SQL Server Management Studio.
2. Open a New Query window with proper SQL connections.Locate/Change to your database.
3. Now if you are looking for a table called 'tblContract' then write below in the query window.

SELECT DISTINCT FROM syscomments sc INNER JOIN sysobjects so on WHERE sc.text LIKE '%tblContract%'

That's it. It will show you all the sp's using the table. So go ahead and start changing them.

Hope that you will like my article. Reach to me in case you need any help.

Happy Coding friends.


No responses found. Be the first to comment...

  • Do not include your name, "with regards" etc in the comment. Write detailed comment, relevant to the topic.
  • No HTML formatting and links to other web sites are allowed.
  • This is a strictly moderated site. Absolutely no spam allowed.
  • Name: