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)

Find a text string in any column in a database

By Kenneth Fisher,

This script is great if you are asked to find every occurance of a string in your database. Set the @Search_For variable to the string you are looking for then run the script and you will get back a table listing every table/column that contains that value.

This is particularly useful when having to make sure you remove all references of a string from your database or if you don't know the structure as well as you might like and need to find some information.

WARNING: This script can take a long time on a large database.

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

Script to Find String in Database object

Script that searches every object in a database for a specific string.


search and replace a string in all user tables’ data in all databases

This script will search for the input string in all the tables(data) from all the databases and will...


Generate script to change column length of string datatypes in a DB

This script can be used to generate alter column length of any string data type column(s) in a datab...


Scripting Remote Database using SMO in .net

Can't script remote database using script method