Search Entire database for String???

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • mycall
    New Member
    • Jan 2007
    • 9

    #1

    Search Entire database for String???

    Is there an easy way to search all tables using a string as search criteria.

    I have started writting a heap of nested for loops, getting table defs and fields however it is becoming a little bit of a pain.

    Is there some kind of select statement one might be able to write in SQL that will search all tables and all fields.

    I would ideally like to go through the database searching for say 'EXT2' and then display the entire row in the table where it is located, with possibilities of more than one result.

    Any ideas greatly appreaciated.
  • Killer42
    Recognized Expert Expert
    • Oct 2006
    • 8429

    #2
    I'd suggest you post this again in the Access forum. (I'm assuming it's Access you're referring to).

    However, your nested-loop technique may turn out to be the best way to go. I'm not aware of any sort of all-tables or all-fields database syntax (apart from Select * of course).

    It might be a good idea to fill in some more detail on your situation, though. What VB version, what database product, etc. Of course, a good generic solution would be largely independent of any specific DBMS.

    Comment

    • willakawill
      Top Contributor
      • Oct 2006
      • 1646

      #3
      The only thing I can think of is a union query with an OR clause for every field in each table

      Comment

      • Killer42
        Recognized Expert Expert
        • Oct 2006
        • 8429

        #4
        Originally posted by willakawill
        The only thing I can think of is a union query with an OR clause for every field in each table
        Yeah, but doesn't UNION insist that the fields from each table must be the same?

        Comment

        • Killer42
          Recognized Expert Expert
          • Oct 2006
          • 8429

          #5
          I wonder whether automation might help. Because I notice that if you do Edit | Find while browsing an Access table, you can choose to search the field or the whole table. Perhaps automation would provide a way into this function.

          Comment

          Working...