0

i want to search all teh fields in my DB to find the field names that have in them a string that contains some text.

im trying to find a table and field responsible for some 3rd party software actions that i am aonly able to see the values for. i want to use these values to find the table and field they are stored in.

kacalapy
  • 9,806
  • 20
  • 74
  • 119
  • Possible duplicate http://stackoverflow.com/questions/591853/search-for-a-string-in-an-all-the-tables-rows-and-columns-of-a-db I swear someone asked this the other day as well and there was an SSMS addin suggested but I can't find that now. – Martin Smith Jun 21 '10 at 19:17

3 Answers3

2

like this

select column_name,table_name
 from information_schema.columns
where column_name like '%text%'

Misunderstood your question, see here: Search all columns in all the tables in a database for a specific value

SQLMenace
  • 132,095
  • 25
  • 206
  • 225
  • i dont care what the clounm name is i want the names of the columns that have a certain string od data with in records or data points of the coloumn. more like this: select Col_Name where Col_Name.data = 'sometext' i dont want fields called sometext... i want the records of the tables that have sometext to report to me the names of the fields that have this data. – kacalapy Jun 21 '10 at 19:17
  • 1
    In that case see here: http://blogs.lessthandot.com/index.php/DataMgmt/DataDesign/the-ten-most-asked-sql-server-questions--1#2 – SQLMenace Jun 21 '10 at 19:20
-1

I don't have specific answer. But i use PHP code for MySQL that calls "show tables" and then for each table calls "show create table [table_name]" I export the result to a text file and then search it...

aviv
  • 2,719
  • 7
  • 35
  • 48