Click here to monitor SSC
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)

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: 695 | Views in the last 30 days: 1
 
Related Articles
SCRIPT

Searching Column Name in All Tables

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

SCRIPT

String Search

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

SCRIPT

Object Search

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

FORUM

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?

SCRIPT

Search for a Column in all databases

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

Tags
miscellaneous    
t-sql    
 
Contribute