Results 1 to 3 of 3

Thread: Simple SQL Question

  1. #1

    Thread Starter
    Hyperactive Member CaptainPinko's Avatar
    Join Date
    Jan 2001
    Location
    London, Ontario, Canada
    Posts
    332

    Simple SQL Question

    i'm sorry if this doesn't belong here but i figure this would be the best place since most servers use SQL in one way or another, so here goes....:

    when i am using the LIKE operator and the * wildcat will it find matches where there is nothing for the letter?

    for example:

    LIKE "cat*" = "cat"?

    or in otherwords is a null character a valid match for a wildcard?
    "There are only two things that are infinite. The universe and human stupidity... and the universe I'm not sure about." - Einstein

    If you are programming in Java use www.NetBeans.org

  2. #2
    Fanatic Member cpradio's Avatar
    Join Date
    Apr 2002
    Posts
    616
    what your search is asking for is that the first three letters be the same in any value it finds.

    For example ('field LIKE "cat*"') if you had the following values in your database:
    - cat
    - category
    - caterer
    - current
    - camera
    - element
    - concatinate

    Your Query would return the following as each of those has their first three letters as "cat" which is all SQL is looking for since you added the wildcard to the end stating anything can follow those three letters:
    - cat
    - category
    - caterer

    If you had 'field LIKE "*cat*"' it would return 4 results:
    - cat
    - category
    - caterer
    - concatinate

    -Matt
    http://cpradio.net/
    Administrator @ WDForums and a Moderator @ WebXpertz City Forums

  3. #3
    PowerPoster
    Join Date
    Jul 1999
    Posts
    5,923
    In Access, * or ? used as wildcards

    Most if not all other SQL servers will use % or _

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width