Search Stored Procedures in MS SQL 2005

Posted on 2/9/2010 | Printable Version | Comments (0)

Sometimes when looking for a bug in web software, you need to find everything that touches a particular database table. In Visual Studio, this is as simple as a global search. But in SQL, you might also want to find every stored procedure that references that table. A quick search online found a great little SQL script that does just that. Here's what to do:
SELECT Name

FROM sys.procedures

WHERE OBJECT_DEFINITION(OBJECT_ID) LIKE '%tblMyTable%'

GO
Thanks to SqlAuthority.com for this code snippet.


Comments

Be the first to comment below.

Post Comment