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

Get your favorite SSC scripts directly in SSMS with the free SQL Scripts addin. Search for scripts directly from SSMS, and instantly access any saved scripts in your SSC briefcase from the favorites tab.
Download now (direct download link)

Add Wildcards to Advanced Search Stored Procedure

By Additional Articles,

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: 489 | Views in the last 30 days: 2
 
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

SCRIPT

Search all stored procedures on all databases

Need to find every stored procedure in any database that references the table FooBar? Here is a qui...

ARTICLE

Search for a Value Throughout Your Database

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

 
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