#1
  1. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Nov 2008
    Posts
    72
    Rep Power
    6

    Like '%ANYTHING%' with all fields in table


    I think I know the answer to this already but thought I'd make sure. Is it possible to do a SQL query with a "Like" match on all fields in the table without listing each table?

    So instead of:

    where lastname like '%DOE%' or firstname like '%DOE%' or address like '%DOE%'

    You could do something like

    "any fields" like '%DOE%'
  2. #2
  3. Bug Hunter
    Devshed Newbie (0 - 499 posts)

    Join Date
    May 2003
    Location
    Transylvania (Romania)
    Posts
    309
    Rep Power
    24

    Arrow


    I don't think is implemented yet , or you can add it to features list if you want

    I would like something like that that will search in all tables


    Code:
    Select foo, bar from db.* where [db.*] like '%foobar%'
    maybe you can do it in a stored procedure

    something like

    1. read all table fields names
    2. put them and execute an

    Code:
    select * from table where [selected_field_names] like '%foobar%'
    the same with multiple tables
    1.select all tables names
    2. put them and execute and
    Code:
    select * from table where [selected_field_names] like '%foobar%'
    My home page: http://www.firebirdsql.org and work place :http://www.reea.net

IMN logo majestic logo threadwatch logo seochat tools logo