tags:

views:

176

answers:

3

We want to search for a string (ie. "Hello World") in all our database that has about 120 tables. We thought about doing a dump like mysql dump but it came out in a weird bak format.

The search should be done in each column for each table. Is this possible with any type of script, or this is harder than it sounds to me?

+1  A: 

No it possible and easy to write a script to do this.

Suggestions: I think you have to use some cursors and use some of these objects to write your script

  1. sys.databases
  2. INFORMATION_SCHEMA.TABLES or sys.tables
  3. INFORMATION_SCHEMA.COLUMNS or sys.columns

Once you have these things in place, searching Hello World under all columns would be more simple

Tamil.SQL
+1  A: 

Is this just for a one-off, or something you want to do regularly?

If it's a one-off, how about using the export data wizard to export the tables out to CSV files (assuming you're using MS-SQL, although I'm sure most databases have equivalents).

Once you've done this you can just do a 'Find Files' in explorer to find all occurrances?

It's a bit dirty - but it'll work!

Chris Roberts