SQL Serverous

SQL Serverous

Alan Wood  //  Professionally: SQL Server consultant
Personally: Geek, musician, sports fan (avid follower of Motherwell in the SPL and the 49ers and Dolphins in the NFL. Also follow the SF Giants in MLB).

Jan 13 / 7:25am

Quick tip: Search for a term in a Stored Procedure

Need to find out if a term is referenced in any stored procedures in your database?  Use the following T-SQL statement...

select name, definition
from sys.procedures p
    inner join sys.sql_modules m
        on p.object_id = m.object_id
where
    m.definition like '%search term%';

This will work in SQL Server 2005 and 2008.

Filed under  //  catalogs   stored procs   tips   tsql  

Comments (4)