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

By Robert Cary,

This script will quickly generate DML to search all the tables in the current database for a given string. It could be modified to execute the generated code if desired. If you are running this in a <2005 environment, convert the VARCHAR(MAX)s to VARCHAR(8000) and be careful of overflowing the variable if you have very wide tables. To use this script, simply set the value of @SearchItem to whatever string it is you are searching for on line 2 then run in the database you wish to search.

Total article views: 2909 | Views in the last 30 days: 4