Results 1 to 6 of 6
  1. #1
    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

    Filter for [ ] (SQL 2000)

    Ok, I admit it, bad design by me but it wasn't in the specification ....honest <img src=/S/grin.gif border=0 alt=grin width=15 height=15>

    I have a list of Products Descriptions some of which have [Q] at the end of them. My task is to create a list of just these descriptions, if I use:

    SELECT *
    FROM Products
    WHERE ProdDesc like '%[Q]'


    I will pull out every thing with a Q in it as is assuming it is a field name.

    What is the syntax, just to pull out things ending with [Q]
    Jerry

  2. #2
    3 Star Lounger
    Join Date
    Mar 2006
    Location
    Pittsburgh, Pennsylvania, USA
    Posts
    289
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: Filter for [ ] (SQL 2000)

    SELECT*
    FROM Products
    WHERE RIGHT([ProdDesc],1)="Q";
    Thanks
    chuck

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

    Re: Filter for [ ] (SQL 2000)

    In Access, you can double the brackets, so try
    <code>
    WHERE ProdDesc like '%[[Q]]'
    </code>
    Don't know if this works in SQL Server too.

  4. #4
    3 Star Lounger
    Join Date
    Mar 2006
    Location
    Pittsburgh, Pennsylvania, USA
    Posts
    289
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: Filter for [ ] (SQL 2000)

    Oops! [Q] I take it is a field. I missed that.
    Thanks
    chuck

  5. #5
    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: Filter for [ ] (SQL 2000)

    Thanks Hans

    That's the baby
    Jerry

  6. #6
    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: Filter for [ ] (SQL 2000)

    Thanks Chuck, I see your thinking, it was my fault for putting reserved characters in the text string,but doubling the square parenthesis is the answer <img src=/S/grin.gif border=0 alt=grin width=15 height=15>
    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
  •