Tuesday, February 18, 2014

How to search for a string in all the objects in SQL Server 2008

Please find the code below to find a particular string in all the objects in SQL Server
 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 '%YOUR_STRING%'
YOUR_STRING is the string that you want to search.This will search the above string in tables,sps and views.

Share this

0 Comment to "How to search for a string in all the objects in SQL Server 2008"

Post a Comment