Loading...
 
JoiWiki » Developer » Databases » SQL Scripts » SSMS Search Stored Procedure Content SSMS Search Stored Procedure Content

SSMS Search Stored Procedure Content

SSMS Search Stored Procedure Content

There are sometimes occasions where you might want to look through your stored procedures for references to tables or other database assets because you don't have direct access to script them yourself. Here's a quick script to let you do that, it can be adapted to do a few things which I'll add later:

 

 

DECLARE @SearchVal AS VARCHAR(250) = 'name'

SELECT DISTINCT o.name AS Object_Name,o.type_desc
FROM sys.sql_modules m
INNER JOIN sys.objects o
ON m.object_id=o.object_id
WHERE m.definition Like '%' + @SearchVal + '%'

 

 

 

 

Created by JBaker. Last Modification: Saturday December 29, 2018 18:29:56 GMT by JBaker.

Developer