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

Total article views: 345 | Views in the last 30 days: 26

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.

By Additional Articles, 2005/01/25

Total article views: 345 | Views in the last 30 days: 26
Your response
 
 
Related Articles
SCRIPT

Search All Stored Procedures in a Database

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

SCRIPT

Insert Update Stored Procedure for a table

Generic Script for Insert Update Stored Procedures

SCRIPT

Search for a String in all Stored Procedures and beyond?

Search for String Occurence with this script in your stored procedures.

ARTICLE

Dynamic creation of Insert, Update, Delete Stored procedure

Automates the creation of INSERT, UPDATE & DELETE stored procedure of a table

FORUM

debugging update and insert stored proc.

debugging update and insert stored proc.

 
Contribute

Free registration required...

To read the rest of this article, and access thousands of other articles, we ask you to register on the site and subscribe to our newsletters.

Login (existing users)

Login

Email:   Password:   Remember me: Forgotten your password?

Register (new users)

Register

Email:   Password:
Confirm:

Subscribing to our newsletters gets you:

  • ALL of our content (thousands of articles, scripts, and forum postings)
  • A daily newsletter (example)
  • A weekly news round up (example)
  • The opportunity to ask and answer questions in our forums
  • A daily Question of the Day to test and help you increase your knowledge of SQL Server.

Steve Jones
Editor, SQLServerCentral.com