Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Text search in Stored Procedures in SQL Server 2005

How do I find a stored procedure containing a certain text? While I understand that the best place to do this kind of searching is through your source control tool, but are there ways to do this in the database?

like image 607
Rohit Agarwal Avatar asked May 28 '09 22:05

Rohit Agarwal


People also ask

How do I search for a stored procedure in SQL?

Find Using Filter Settings In Object ExplorerIn the Object Explorer in SQL Server Management Studio, go to the database and expand it. Expand the Programmability folder. Right Click the Stored Procedures folder. From the right-click menu, select Filter in the right-click menu.

How do I find a specific text in SQL?

You just need to write that keyword and press shortcut key. For example: I want to search 'PaymentTable' then write 'PaymentTable' and make sure you select or highlight the written keyword in query editor and press shortcut key ctrl+4 - it will provide you full result.


1 Answers

SELECT ROUTINE_NAME, ROUTINE_DEFINITION 
    FROM INFORMATION_SCHEMA.ROUTINES 
    WHERE ROUTINE_DEFINITION LIKE '%your text here%' 
    AND ROUTINE_TYPE='PROCEDURE'
like image 155
Russ Bradberry Avatar answered Nov 08 '22 18:11

Russ Bradberry