How To: Search a specific object or keyword within all list of stored procedures in MS SQL Server 2005

Posted: September 20, 2008 in SQL
Tags: ,

Today I came to know how to search for a specific keyword or any object like tables or columns of any tables used in a procedure. This is really useful when you have a bunch of procedures and you need to findout the procedure that have some specific tables, columns or even any keyword you wanted to search.

Here is the SQL Query that will be useful to get appropriate result set of stored procedures which contains your provided search keywords.

SELECT Name
FROM sys.procedures
WHERE OBJECT_DEFINITION(OBJECT_ID) LIKE '%your keyword%'

Advertisements
Comments
  1. proczuha says:

    i agreed with author. thanksq

  2. Johnnie says:

    I’ve always used this kind of query myself, but I find that it doesn’t get all the objects. Its as if the definition in the database is truncated.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s