Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 

Add Wildcards to Advanced Search Stored Procedure

By Additional Articles, 2005/01/25

I have found that I can add wildcard support to the Advanced Search Stored Procedure submitted by jgroseth (Posted: 07/02/2004) here:
http://www.sqlservercentral.com/scripts/contributions/1201.asp

by simply modifying "charindex( c.string," to "patindex('%' + c.string + '%'"

I did this to take varying whitespace into account since SQL server does not care about whitespace, for example
"INSERT INTO DATABASE_MYTABLE" could have any number of spaces between "INSERT", "INTO", and "DATABASE_MYTABLE", Without wildcards one would need to search for every stored procedure that contained these three words. With wildcards we can limit the search to the three words in sequence"
"INSERT %INTO %DATABASE_MYTABLE"

My change hardly justifies changing the credit for this great stored proceure, so I left the credits as they are.

Total article views: 473 | Views in the last 30 days: 1
 
Related Articles
SCRIPT

Search All Stored Procedures in a Database

Search for a text in all the stored Procedures in a Database

FORUM

Searching complete database

Searching complete database

ARTICLE

Search for a Value Throughout Your Database

Learn how to search for a value throughout all database tables.

FORUM

Searching stored procedure for table name but ignoring comments

Need to exclude comments from search on stored procedures

 
Contribute

Join the most active online SQL Server Community

SQL knowledge, delivered daily, free:

Email address:  

You make SSC a better place

As a member of SQLServerCentral, you get free access to loads of fresh content: thousands of articles and SQL scripts, a library of free eBooks, a weekly database news roundup, a great Q & A platform… And it’s our huge, buzzing community of SQL Server Professionals that makes it such a success.

Join us!

Steve Jones
Editor, SQLServerCentral.com

Already a member? Jump in:

Email address:   Password:   Remember me: Forgotten your password?
Steve Jones