Tuesday, January 20, 2015

SQL Script to search stored procedures containing a given text

Sometimes we need to find out how many stored procedures contains a given text. Below SQL query can be used to find out the list of all the stored procedures which contains a  particular given text as input.

SELECT OBJECT_NAME(object_id), OBJECT_DEFINITION(object_id)
FROM sys.procedures
WHERE OBJECT_DEFINITION(object_id) LIKE '%Given text%'

1 comment:

  1. Excellent post.This sql query is very helpful for the readers.I am waiting for your next article.The writing format is good.

    ReplyDelete