.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
 
Sign In
Register
 
Win Surprise Gifts!!!
Congratulations!!!


Top 5 Contributors of the Month
david stephan

Home >> Code Snippets >> SQL Query >> Post New Resource Bookmark and Share   

 Subscribe to Code Snippets

How to find sql server objects containing a specific string

Posted By:Kemal AL GAZZAH       Posted Date: June 24, 2011    Points: 40    Category: SQL Query    URL: http://www.dotnetspark.com  

A sql script showing how to find sql server objects(stored procedure, Views) based on key string
 

If you want to find stored procedures or views which contain a specific string in their source, you can use the following sql script

 

declare @str as nvarchar(100);

set @str='Put your string here';

select o.name from sysobjects o inner join syscomments c
on o.id=c.id where c.ctext like
'%'+@str+' %'


     

Further Readings:

Responses

No response found. Be the first to respond this post

Post Comment

You must Sign In To post reply
Find More code samples in C#, ASP.Net, Vb.Net and more Here

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend