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)

Search All Columns in All Tables for a string

By tcartwright,

This procedure can search all columns in one or all tables for a specified string. Prints out the TableName.ColumnName that the string is found in...

--     Example Calls
--     EXECUTE spFindTextInColumns MyTable, 'tcart' --search a specific table
--     EXECUTE spFindTextInColumns default, 'tcart' --search all tables BUG FIX : (2003/01/20) Changed SELECT @columnName = [COLUMN_NAME], to: SELECT @columnName = '[' + [COLUMN_NAME] ']', to avoid: Line 1: Incorrect syntax near '~' Thanks to Avraham de-Haan for pointing this one out.

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

Searching Column Name in All Tables

Use this script to search for a specific column name in all tables in a current database.


String Search

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


Object Search

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


How to encrypt column data which is configured for full text search?

Any ZIP file IFilter which will do encrypt/decrypt on full text search column?


Search for a Column in all databases

This Script can be used for searching a column in SQL server 2005


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