SQL Clone
SQLServerCentral is supported by Redgate
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:

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"

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

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

Search All Stored Procedures in a Database

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


Searching complete database

Searching complete database


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...


Search for a Value Throughout Your Database

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