I have "read" access to a database back end however the tables and columns are named oddly and I am unable to find the information I am looking for. (there are also a lot of tables and lots of data)
I have been using the following method:
Run query:
SELECT * 
FROM information_schema.columns 
WHERE TABLE_SCHEMA = 'dbname' 
  AND DATA_TYPE = 'varchar'
  AND TABLE_NAME IN (SELECT TABLE_NAME 
                     FROM information_schema.tables 
                     WHERE TABLE_TYPE = 'BASE TABLE')
This gives me a list of columns which contain varchar values...
Then for each result, I run the following:
select top 1 [column name] 
from [tablename] 
where [column name] like 'value I'm searching for'
Is there a better way to do this? Or a way to combine these two queries together (as running the query on each result is a slow method)?
Thanks in advance
 
    