• Search string in SQL contains brackets (Access 2003)

    Home » Forums » AskWoody support » Productivity software by function » MS Access and database help » Search string in SQL contains brackets (Access 2003)

    Author
    Topic
    #436744

    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

    Viewing 1 reply thread
    Author
    Replies
    • #1036301

      The expression [T,C] means ‘either T or C’ in SQL. To tell SQL that [ is a literal character, enclose it in square brackets:

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

    • #1036291

      (Edited by Jezza on 30-Oct-06 20:48. To delete rubbish answer)

      Drew

      ###ignore this#### see Hans’ post 610,581

    Viewing 1 reply thread
    Reply To: Search string in SQL contains brackets (Access 2003)

    You can use BBCodes to format your content.
    Your account can't use all available BBCodes, they will be stripped before saving.

    Your information: