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

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

The Ultimate Precompiled Procedure Searcher

By Jesse Roberge,

*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=
Util_ProcSearch
By Jesse Roberge - YeshuaAgapao@Yahoo.com

Searches precompiled procedures (stored procs,triggers,functions) for the provided search string.
LIKE wildcards are not automatic, which allows for easy 'begins with', 'ends with', and 'equal to' queries.
Also provides snippets of @CharCount length centered on the first found instance of the searched-for string

Update 2009-09-21:
Added @SchemaSearch to be able to filter by schema name patterns
Added views to the @Type default list (making the default 'all')
Change sort to sort by SchemaName before TableName

Update 2009-10-01:
Added searching of system procs/functions/views/triggers
Added parent object output (for triggers)

Required Input Parameters
@BodySearch VarChar(1000) The string to search proc/func/trigg bodies for. Accepts LIKE Wildcards

Optional Input Parameters
@Type VarChar(100)='FN,IF,P,TF,TR,V' Type of objects to search. Same codes as sys.objects.type
@NameSearch VarChar(250)='' Restrict body searches to procs that match this object name pattern. Accepts LIKE Wildcards
@SchemaSearch VarChar(250)='' Restrict body searches to procs that match this schema name pattern. Accepts LIKE Wildcards
@CharCount int=40 Size of the snippets - # of chars before and after match
@UserOjbects TinyInt=1 Search user objects
@SystemObjects TinyInt=0 Search system objects

Usage
EXECUTE Util_ProcSearch '%order%', 'TR'
EXECUTE Util_ProcSearch @BodySearch='%cart%', @NameSearch='%order%', @SchemaSearch='dbo', @Type='P,TR', @CharCount=80

Copyright:
Licensed under the L-GPL - a weak copyleft license - you are permitted to use this as a component of a proprietary database and call this from proprietary software.
Copyleft lets you do anything you want except plagarize, conceal the source, or prohibit copying & re-distribution of this script/proc.

This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as
published by the Free Software Foundation, either version 3 of the
License, or (at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Lesser General Public License for more details.

see <http://www.fsf.org/licensing/licenses/lgpl.html> for the license text.

*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=

Total article views: 1835 | Views in the last 30 days: 2
 
Related Articles
FORUM

Full Text Search Wildcards

full text search wildcard returning all rows

FORUM

Search does not work on varchar(max)

Search does not work on varchar(max)

SCRIPT

Object Search

Procedure to search any database (or a combination of databases, including all) for a specific strin...

SCRIPT

The Ultimate Object Searcher

Searches for objects (including CLR) who's names contain the search string. outputs IDs, names, and ...

Tags
 
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