Thursday, 7 July 2016

How do I find all stored procedure containing ? In SQL Server

Query to find all stored procedure containing <text>? In SQL Server
Description:

In this example we explain that how to find all Stored Procedure containing text. Or how do I find a stored procedure procedure contain a text. Search text in a stored procedure in SQL Server. Search string in a stored procedure. Find all procedure in SQL Server that contains a specified text. Find stored procedure by a string.

There are lots of question are arise in our mind when we would not know that how many procedure are used like we search.

Suppose we have requirement like find all the stored procedure in SQL Database which contain a particular text that may be a field name or any declare variable name or anything.




So below is the SQL Query that demonstrates how to find the all procedure that contain a specified text.


Query:

SELECT OBJECT_NAME(id)    
FROM syscomments
WHERE [text] LIKE '%Retrieve%'
AND OBJECTPROPERTY(id, 'IsProcedure') = 1
GROUP BY OBJECT_NAME(id)
This entry was posted in :

0 comments:

Post a Comment