Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Database & SysAdmin
  3. Database
  4. SQL search all columns [modified]

SQL search all columns [modified]

Scheduled Pinned Locked Moved Database
questiondatabasetutorial
3 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • E Offline
    E Offline
    Expert Coming
    wrote on last edited by
    #1

    I am trying to do a search on all the data in a specific table. How do I search across all columns? And how do I search period? The LIKE command isn't working how I'd like it to, or I am not using it right. EXAMPLE: Player Name: John Doe Johnny Hopkins Night Hawk I would like to be able to search 'john' and get the first two records return, or 'doe' for the first, or 't h' and get the third ect. The LIKE command seems to be too picky although I may be wrong... Thanks for your time.

    The best way to accelerate a Macintosh is at 9.8m/sec² - Marcus Dolengo

    modified on Saturday, March 7, 2009 10:51 AM

    L K 2 Replies Last reply
    0
    • E Expert Coming

      I am trying to do a search on all the data in a specific table. How do I search across all columns? And how do I search period? The LIKE command isn't working how I'd like it to, or I am not using it right. EXAMPLE: Player Name: John Doe Johnny Hopkins Night Hawk I would like to be able to search 'john' and get the first two records return, or 'doe' for the first, or 't h' and get the third ect. The LIKE command seems to be too picky although I may be wrong... Thanks for your time.

      The best way to accelerate a Macintosh is at 9.8m/sec² - Marcus Dolengo

      modified on Saturday, March 7, 2009 10:51 AM

      L Offline
      L Offline
      Lost User
      wrote on last edited by
      #2

      That sounds an awfull lot like a Full Text Search. Someone made an example here[^] :)

      I are troll :)

      1 Reply Last reply
      0
      • E Expert Coming

        I am trying to do a search on all the data in a specific table. How do I search across all columns? And how do I search period? The LIKE command isn't working how I'd like it to, or I am not using it right. EXAMPLE: Player Name: John Doe Johnny Hopkins Night Hawk I would like to be able to search 'john' and get the first two records return, or 'doe' for the first, or 't h' and get the third ect. The LIKE command seems to be too picky although I may be wrong... Thanks for your time.

        The best way to accelerate a Macintosh is at 9.8m/sec² - Marcus Dolengo

        modified on Saturday, March 7, 2009 10:51 AM

        K Offline
        K Offline
        Kschuler
        wrote on last edited by
        #3

        What does your SQL statement look like? It should look something like this: SELECT PlayerName FROM Table WHERE UPPER(FirstName) LIKE '%JOHN%' OR UPPER(LastName) LIKE '%JOHN%' But if you really have to search ALL columns you will have to add a LIKE for each column name in the WHERE portion of you statement. Hope this helps.

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups