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

Search All Columns in all tables

By Robert Cary, 2007/01/23

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: 2885 | Views in the last 30 days: 5
 
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