Click here to Skip to main content
11,637,176 members (69,718 online)
Click here to Skip to main content

Tagged as

Get given string instance from SQL database

, 19 Jan 2011 CPOL 6.3K 1
Rate this:
Please Sign up or sign in to vote.
This is a SQL query to search particular string instance from SQL database.
Once I had to get given string instance from SQL database within the instances of my database objects, like from table, stored procedure, etc.

My role was to replace status text Active, Inactive, Pending and NA with something else provided by the client. I didn't know in how many stored procedures this status was used, but had information that all the item statuses were managed via stored procedures. For example, consider the member status. They were using case statements to check the status.
CASE WHEN Status = 0 THEN 'Active' WHEN Status = 1 THEN 'InActive' WHEN Status = 2 THEN 'Pending' ELSE 'NA' END AS MemberStatus

So, I used the following query to find the list of database objects in which to search for the particular term.
SELECT routine_name, routine_definition  FROM information_schema.routines where routine_definition like '%Active%'

One can filter it based on the requirement, like append AND condition, with routine_type = 'procedure' or as per requirement.

Hope it helps.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

Share

About the Author

That's Aragon
Software Developer (Senior)
India India
No Biography provided

You may also be interested in...

Comments and Discussions

 
GeneralThank you for the comment and vote Gandalf! Pin
That's Aragon27-May-11 3:36
memberThat's Aragon27-May-11 3:36 
GeneralReason for my vote of 5 Thanks for Sharing, It helped me. Pin
Gandalf - The White27-Jan-11 1:58
memberGandalf - The White27-Jan-11 1:58 
GeneralThanks for comment Lyra. Pin
That's Aragon19-Jan-11 0:26
memberThat's Aragon19-Jan-11 0:26 
GeneralGood tip Aragon, Thanks. Pin
Lyra Belaqua19-Jan-11 0:05
memberLyra Belaqua19-Jan-11 0:05 
GeneralThank you Pranay. :) Pin
That's Aragon18-Jan-11 23:43
memberThat's Aragon18-Jan-11 23:43 
GeneralReason for my vote of 4 thanks for sharing... Pin
Pranay Rana18-Jan-11 23:26
memberPranay Rana18-Jan-11 23:26 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

| Advertise | Privacy | Terms of Use | Mobile
Web02 | 2.8.150728.1 | Last Updated 19 Jan 2011
Article Copyright 2011 by That's Aragon
Everything else Copyright © CodeProject, 1999-2015
Layout: fixed | fluid