C# Tutorials and offshore development in India
    Tutorials   Resources   Forum   Reviews   Communities   Interview   Jobs   Projects   Training   Your Ad Here    
Silverlight Games | Mentor | Code Converter | Articles | Code Factory | Computer Jokes | Members | Peer Appraisal | IT Companies | Bookmarks | Polls | Revenue Sharing | Lobby | Gift Shop |


Prizes & Awards
My Profile



Active Members
TodayLast 7 Days more...






Resources » Code Snippets » SQL »

Finding a text in a Stored Procedure & User Defined Function


Posted Date: 28 Oct 2009    Resource Type: Code Snippets    Category: SQL
Author: MelchiorMember Level: Gold    
Rating: 1 out of 5Points: 5



Finding a text in a Stored Procedure & User Defined Function



Because of the implementation of new error handling, i searched for the list of stored procedure having PRINT statement.I didn't find any simple method to find that list to replace the PRINT statement by RAISERROR statement.

After the analysis, i identified the simple solution as shown below.

Let's say you are searching for 'PRINT' in all your stored procedures. You can do this using the INFORMATION_SCHEMA.ROUTINES view, or syscomments:

SQL Query statement



SELECT ROUTINE_NAME, ROUTINE_DEFINITION FROM INFORMATION_SCHEMA.ROUTINES WHERE ROUTINE_DEFINITION LIKE '%PRINT%'
AND ROUTINE_TYPE='PROCEDURE'


We can use this for user defined function also.Let's say you are searching for 'RETURN' in all your user defined functions

SQL Query statement



SELECT ROUTINE_NAME, ROUTINE_DEFINITION FROM INFORMATION_SCHEMA.ROUTINES WHERE ROUTINE_DEFINITION LIKE '%RETURN%'
AND ROUTINE_TYPE='FUNCTION'



Responses


No responses found. Be the first to respond and make money from revenue sharing program.

Feedbacks      
Popular Tags   What are tags ?   Search Tags  
Sign In to add tags.
Finding text in the udf and usp  .  Finding a text in a Stored Procedure & User Define  .  

Post Feedback


This is a strictly moderated forum. Only approved messages will appear in the site. Please use 'Spell Check' in Google toolbar before you submit.
You must Sign In to post a response.
Next Resource: How to use a Table Variable in T-SQL
Previous Resource: Getting multiple row values in a single cell separated by comma`s in sql
Return to Discussion Resource Index
Post New Resource
Category: SQL


Post resources and earn money!
 
More Resources



dotNet Slackers

About Us    Contact Us    Privacy Policy    Terms Of Use