Find certain text in all object definitions in a DB

The following SQL script will find all occurrences of a specific like clause.

This will check definitions of Triggers, Functions, Stored Procs, Views etc

select o.name,m.definition  
from sys.sql_modules m 
inner join sysobjects o on m.object_id=o.id 
where [definition] like '%last_contact_time%' 

image

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: