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

Top 5 Contributors of the Month
Sandeep Singh
Melody Anderson
Eminent IT

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

 Subscribe to Code Snippets

Search a string in all Stored Procedure

Posted By:volvo       Posted Date: November 24, 2013    Points: 40    Category: SQL Query    URL: http://www.dotnetspark.com  

This article explains how to any text used in all the Stored Procedures of a database.

Recently, I come to an issue which need to be fix in some sored procedure. I need to modify field.This was used in multiple stored procedure.I was needed to search for all the Stored Procedures having a given text in its definition. So, I searched and found most of the top results returned were suggesting to use INFORMATION_SCHEMA.ROUTINES view like below, which is not going to return correct result in all the scenario's.

So I write a script as below and fixed the issue.

FROM sys.procedures
WHERE OBJECT_DEFINITION(object_id) LIKE '%@ApplicationId%'


Further Readings:


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