Thursday, June 11, 2015

Search text in SQL Stored Procedure



#Declare an input text as given below.

DECLARE@SEARCH_TEXT VARCHAR(255)
SET@SEARCH_TEXT= 'nitindhiman@gmail.com’

#Query for Search Text in Stored Procedure

SELECT DISTINCT
OBJ.NAME AS OBJECT_NAME,
OBJ.TYPE_DESC
FROM SYS.SQL_MODULES MOD
INNER JOIN SYS.OBJECTS OBJ ON MOD.OBJECT_ID = OBJ.OBJECT_ID
WHERE MOD.DEFINITION LIKE '%'+@SEARCH_TEXT+'%'
ORDER BY TYPE_DESC


No comments:

Post a Comment