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)

String-search on objects in a specified database

By anonuser,

Procedure 'p_find_string' allows users to specify any database on a server in searching for a specified character string.  Supported for string-searching:  table columns, view columns, trigger, function, and procedure code.  Produces a report showing: object type, owner, object name, column id (for tables and views) or what line number (for triggers, functions, and procedures), and the name and definition (for tables and views) or the line of code (for triggers, functions, and procedures).

Example:  Search the pubs database for all columns and lines of code containing the string 'author':

EXEC p_find_string @p_string = 'author'
                 , @p_dbname = 'pubs'

Pre-requisites:  Functions 'f_contains' and 'f_delimited', and stored procedure 'p_get_column_attribute', which I previously submitted.

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

String Search

Search for a string value within columns of data types CHAR, NCHAR, NTEXT, NVARCHAR, TEXT, VARCHAR, ...


Search for a String in all Stored Procedures and beyond?

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


Object Search

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


search string help needed...

search string help needed...


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

Already a member? Jump in:

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