How do I do a search on a string ( But I need it to be case sensitive )

  • Select * FROM TAB1 wher AI_TEXT_VALUE like '%PE%'

    The unfortunate thing is i get entries like <Perennial allergic rhinitis>

    I am looking specifically for the term PE ( All upper case ) But keep in mind, I would need to use the LIKE operator in my where clause.

    ( just like in the example above )

  • mw112009 (6/15/2015)


    Select * FROM TAB1 wher AI_TEXT_VALUE like '%PE%'

    The unfortunate thing is i get entries like <Perennial allergic rhinitis>

    I am looking specifically for the term PE ( All upper case ) But keep in mind, I would need to use the LIKE operator in my where clause.

    ( just like in the example above )

    Select * FROM TAB1 wher AI_TEXT_VALUE like '%PE%' COLLATE Latin1_General_BIN;

    The collation used means that an exact binary match must occur. A pleasant side effect is that it might make your non-SARGable LIKE a bit faster.

    --Jeff Moden


    RBAR is pronounced "ree-bar" and is a "Modenism" for Row-By-Agonizing-Row.
    First step towards the paradigm shift of writing Set Based code:
    ________Stop thinking about what you want to do to a ROW... think, instead, of what you want to do to a COLUMN.

    Change is inevitable... Change for the better is not.


    Helpful Links:
    How to post code problems
    How to Post Performance Problems
    Create a Tally Function (fnTally)

  • Thank you that works!

    I owe you a beer.

  • mw112009 (6/15/2015)


    Thank you that works!

    I owe you a beer.

    Beer? BEER? [font="Arial Black"]BEER![/font] Heh... ok... where are you at in the world? I might just try to collect on that someday. 😀

    --Jeff Moden


    RBAR is pronounced "ree-bar" and is a "Modenism" for Row-By-Agonizing-Row.
    First step towards the paradigm shift of writing Set Based code:
    ________Stop thinking about what you want to do to a ROW... think, instead, of what you want to do to a COLUMN.

    Change is inevitable... Change for the better is not.


    Helpful Links:
    How to post code problems
    How to Post Performance Problems
    Create a Tally Function (fnTally)

  • Ann Arbor, MICHIGAN 48105

    Drop by if you are closeby

  • mw112009 (6/15/2015)


    Ann Arbor, MICHIGAN 48105

    Drop by if you are closeby

    Auburn Hills, MI here. Do you ever go to the PASS meetings in Southfield?

    --Jeff Moden


    RBAR is pronounced "ree-bar" and is a "Modenism" for Row-By-Agonizing-Row.
    First step towards the paradigm shift of writing Set Based code:
    ________Stop thinking about what you want to do to a ROW... think, instead, of what you want to do to a COLUMN.

    Change is inevitable... Change for the better is not.


    Helpful Links:
    How to post code problems
    How to Post Performance Problems
    Create a Tally Function (fnTally)

  • Sorry, NO.

    What is PASS anyway ?

  • mw112009 (6/15/2015)


    Sorry, NO.

    What is PASS anyway ?

    PASS is the "Professional Association for SQL Server". It's responsible for many things in the SQL Server community including but not limited to SQL Saturdays, the world-wide gathering once a year known as the PASS Summit (huge week long event), and helping local groups of people get together in "PASS Local Chapters".

    Our local chapter meets in the Microsoft offices in Southfield usually on the 2nd Thursday of the each month (it does vary depending on speaker availability and a couple of other things) and there's always something good to learn each month at the meetings.

    If you'd like to know more, send me an email through this site and I'll have them add your email address to the meeting notifications. If nothing else, the free pizza is good and some of us get together at one of the local pubs to share stories, problems, and solutions.

    --Jeff Moden


    RBAR is pronounced "ree-bar" and is a "Modenism" for Row-By-Agonizing-Row.
    First step towards the paradigm shift of writing Set Based code:
    ________Stop thinking about what you want to do to a ROW... think, instead, of what you want to do to a COLUMN.

    Change is inevitable... Change for the better is not.


    Helpful Links:
    How to post code problems
    How to Post Performance Problems
    Create a Tally Function (fnTally)

Viewing 8 posts - 1 through 7 (of 7 total)

You must be logged in to reply to this topic. Login to reply