Results 1 to 3 of 3
  1. #1
    2 Star Lounger
    Join Date
    May 2002
    Location
    Quincy, Illinois
    Posts
    138
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Search string in SQL contains brackets (Access 2003)

    Hello,

    I have the following SQL/Query setup. When running this, the query returns no results even though I know their is 1 record in my table that includes this string. I know that it has to do with the brackets being used, but I don't know how to get around it and specify a literal bracket. Please help.

    SELECT TIAM_Orig.Item_ID, TIAM_Orig.LDesc
    FROM TIAM_Orig
    WHERE (((TIAM_Orig.LDesc) Like "*271JXAM[T,C]*"));

    Thanks in advance,
    Drew

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Search string in SQL contains brackets (Access 2003)

    The expression <code>[T,C]</code> means 'either T or C' in SQL. To tell SQL that <code>[</code> is a literal character, enclose it in square brackets:
    <code>
    SELECT TIAM_Orig.Item_ID, TIAM_Orig.LDesc
    FROM TIAM_Orig
    WHERE (((TIAM_Orig.LDesc) Like "*271JXAM[[]T,C]*"));</code>

  3. #3
    Platinum Lounger
    Join Date
    Feb 2002
    Location
    A Magic Forest in Deepest, Darkest Kent
    Posts
    5,681
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: Search string in SQL contains brackets (Access

    <P ID="edit" class=small>(Edited by Jezza on 30-Oct-06 20:48. To delete rubbish answer)</P>Drew

    ###ignore this#### see Hans' <post:=610,581>post 610,581</post:>
    Jerry

Posting Permissions

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