2

Is there a query or tool that will search all tables/fields for a particular value? The program is storing cost in a field and I can't find it. Profiler is not an option.

Thanks in advance, Bryan Moore

user1577713
  • 49
  • 1
  • 1
  • 3
  • what RDMS? Sql Server? – Massimiliano Peluso Feb 15 '13 at 16:28
  • Why are you searching for all tables and fields for a particular value? Doesn't make sense... – Kaf Feb 15 '13 at 16:28
  • You haven't specified a database, but since you say "Profiler isn't an option", I assume it's SQL Server. In that case, duplicate of http://stackoverflow.com/questions/709120/how-to-search-for-one-value-in-any-column-of-any-table-inside-one-ms-sql-databas, http://stackoverflow.com/questions/436351/how-do-i-find-a-value-anywhere-in-a-sql-server-database and http://stackoverflow.com/questions/1796506/search-all-tables-all-columns-for-a-specific-value-sql-server – LittleBobbyTables - Au Revoir Feb 15 '13 at 16:28
  • 1
    Very strange question. Nevertheless, you could sift through all of the columns in your database to see any that look sensible and query them. In Oracle, you would `select table_name, column_name from user_tables, user_tab_cols where user_tab_cols.table_name = user_tables.table_name and upper(column_name) like upper('%mybestguess%')`. Good luck! – wmorrison365 Feb 15 '13 at 16:31
  • The RDMS is SQL Server. A program I am using is storing cost in a table/field and I cannot find where. There are 200+ tables in the database with many tables having 50+ fields. I want to assign a unique cost to an item and then search the entire database/tables/fields to find every instance where my unique number has been stored. If anyone knows a better way to find where a value is stored when they don't know, I am open to suggestions. Thanks, Bryan – user1577713 Feb 15 '13 at 16:37
  • See here: http://stackoverflow.com/a/5350405/330315 –  Feb 15 '13 at 20:02

1 Answers1

0

there are a couple of undocumented stored procedures which iterate across all tables and all db however the exact answer is here: http://vyaskn.tripod.com/search_all_columns_in_all_tables.htm Actually this is a fine site and well worth general browsing as there are numerous answers to obsure and not so obsure questions that come up from time to time.

Hope this helps

Ian P
  • 1,724
  • 1
  • 10
  • 12