Skip to Content
author's profile photo Former Member
Former Member

Case sensitivity using "LIKE" in a WHERE-condition

Dear experts,

does anybody know if there is a way to use LIKE in a WHERE clause regardless wether the word(s) searched for is written with a leading capital letter or not?

Thanks in advance

Andreas

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

6 Answers

  • Posted on Oct 05, 2009 at 10:12 AM

    For that check if the checkbox "Lowercase" is checked for the domain of the field. If yes, then the field is case sensitive 😉

    BR,

    Suhas

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Oct 05, 2009 at 10:39 AM

    Hi again Andreas,

    What you are looking for is the UPPER() in t-sql (..where upper(name) LIKE 'MEIER%' am i right?) and similar languages, but this functionality is not directly present in open-sql. You'll need to implement it manually.

    Ozcan.

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Oct 05, 2009 at 10:21 AM

    open the domain of that data element you are dealing with.

    in that domain if Lower Case is ticked means the domain is case sensitive. if thats not checked, you dont have to worry anything about it,

    which field are you talking about

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Oct 05, 2009 at 10:22 AM

    Hi,

    you must pay attention to the nature of the field in your query. Most field values in SAP are converted automatically when saving to capital letters, since checkmark Lowercase is not marked in the domain behind that field. Additionally, there´s no addition for instruction Select for considering capital letters.

    You must probably work with instruction TRANSLATE TO UPPER/LOWER CASE before calling the Select instruction.

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Oct 05, 2009 at 10:30 AM

    Hi Andreas;

    You can use a range to perform case-insensitive search.

    For example, your range will contain following lines

    Line No | Sign | Option | Low

    1 | EQ | I | Meier

    2 | EQ | I | MEIER

    3 | EQ | I | meier

    And assuming your range is defined as R_NAME1, your search will look like;

    SELECT ...

    FROM...

    WHERE ...

    .. AND NAME1 IN R_NAME1.

    It won't provide 100% success, but I hope it helps.

    Ozcan.

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Oct 05, 2009 at 10:37 AM

    > Dear experts,

    >

    > does anybody know if there is a way to use LIKE in a WHERE clause regardless wether the word(s) searched for is written with a leading capital letter or not?

    >

    > Thanks in advance

    >

    > Andreas

    Yes! Use real SQL and prefix the column with the UPPER function. But unfortunately you can't do this in SAP's Open SQL.....

    If this is your own custom table, the other way of doing this is to hold the value in uppercase in another column and search on that. SAP does this quite often.

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.