Results 1 to 3 of 3
  1. #1
    Join Date
    Jan 2009
    Posts
    4

    Unanswered: Usage of LIKE statement with wildcards

    Hi.

    Have been a silent spectator of the forum for a while..

    had a quick question.

    can the LIKE be used with the Wildcard only at the beginning of the data.

    for example, I need all records ending with 6343.

    I Tried using
    select (*) from abcd
    where
    Account LIKE '%6343'

    but am not getting any records.

    using like

    select (*) from abcd
    where
    Account LIKE '%6343%'


    lists all records containing 6343 which is not the result set i am looking for.

    any suggestions?


    thanks

  2. #2
    Join Date
    Jun 2003
    Location
    Toronto, Canada
    Posts
    5,516
    Provided Answers: 1
    This could happen if the ACCOUNT column is defined as CHAR, in which case it may contain trailing spaces to fill the column value to the specified length. Try "RTRIM(ACCOUNT) LIKE '%6343'".
    ---
    "It does not work" is not a valid problem statement.

  3. #3
    Join Date
    Jan 2009
    Posts
    4
    Quote Originally Posted by n_i
    This could happen if the ACCOUNT column is defined as CHAR, in which case it may contain trailing spaces to fill the column value to the specified length. Try "RTRIM(ACCOUNT) LIKE '%6343'".

    thanks a lot..

    now i feel dumb :P

Posting Permissions

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