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

Get your favourite SSC scripts directly in SSMS with the free SQL Scripts addin. Search for scripts directly from SSMS, and instantly access any saved in your SSC briefcase from the favorites tab.
Download now (direct download link)

Search All Fields in db for a Specific String

By Lowell Izaguirre,

forums question came up where someone needed to search every varchar/char field in the database, and find any table/field that had a specific value (ie ip address, email, servername)
we all agree that a monster scan like this is bad, but bad or not, sometimes you need to do it.

it returns results that look something like this:
TBLNAME COLNAME SQL
CITYDATA CITYNAME SELECT * FROM CITYDATA WHERE CITYNAME LIKE 'TEST'
GMHUDMX HUDMXTITLE SELECT * FROM GMHUDMX WHERE HUDMXTITLE LIKE 'TEST'
RB_FIELD FIELD_ALIAS SELECT * FROM RB_FIELD WHERE FIELD_ALIAS LIKE 'TEST'
RB_FIELD FIELD_NAME SELECT * FROM RB_FIELD WHERE FIELD_NAME LIKE 'TEST'

Total article views: 232 | Views in the last 30 days: 2
 
Related Articles
FORUM

Identify duplicate records where all fields, except one field, are the same.

HELP! I need to flag duplicate records where the price field is different but all other fields are t...

FORUM

Date field in Select & Group by

having trouble with Start Date field when included in select and group by clause

FORUM

Conditional Where Clause

Select how the Where Clause operates

FORUM

"Select Where In" using a parameter?

select intCol from Tablename where intCol in (@intList)

FORUM

Select Where Any Column Equals (or Like) Value

Select row(s) where any of the column names in table equals a value

Tags
miscellaneous    
 
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