How to get Case Sensitivity in Teradata


Teradata by default is case insensitive. Whatever value you compare in the WHERE clause it does not match the exact case of that value.

So what if there is a scenario when you want to compare the value along with its specific case in the WHERE clause. Here come the CASESPECIFIC keyword for the rescue.Just by adding this keyword after the value in WHERE clause we can force the Teradata to impose case sensitivity on the checking condition

Here are some example to understand it better –

1.) SELECT CURRENT_DATE

WHERE

UPPER(‘teradata’) = ‘teradata’ (CASESPECIFIC); —- This Query will not return the current_date

2.) SELECT CURRENT_DATE

WHERE

LOWER(‘teradata’) = ‘teradata’ (CASESPECIFIC) —– This query will return the current_date

3.) SELECT emp_name

FROM emp_table

WHERE emp_name (CASESPECIFIC) LIKE ‘John%’ —— This query will return all name starting with capital J only

So just by using CASESPECIFIC we can force Teradata to check for case sensitivity


6 comments

1 ping

Skip to comment form

  1. Hey guys, just tried out fortunegodsvn. Seeing some decent action there! Definitely worth checking out if you’re looking for something new to play. Link is fortunegodsvn

  2. Okay, let me tell you about win757net. I tried them out and I was not dissapointed!. The site is so easy and you’ll find yourself using it all the time!. Check em out at win757net.

  3. Yo, Jili1888CasinoLogin is where it’s at! A good selection of games and the logging in was a breeze. Highly recommend giving it a look! jili1888casinologin

    • Shardul on September 7, 2017 at 9:45 pm
    • Reply

    Case specific comparison is also governed by TMODE.
    ANSI mode is case sensitive while TERA mode is not, I think (or may be vice versa).

    For example, in ANSI mode,
    WHERE City = 'Bangalore' will be a case-specific search.

    In TERA mode, it will not be the case.
    WHERE City = 'bangalore' will search for Bangalore in a non case-specific manner.

    • zbiggy on December 20, 2011 at 1:57 pm
    • Reply

    hey,
    why WHERE empname(CASESPECIFIC) LIKE ‘John%’ will return “all name starting with capital J only?”

    does that mean this will return true if the empname = e.g. ‘Jordan’?

    1. Hi ,

      No ‘Jordan’ will not be returned by this query because it will check for John%

      what i meant to say here that –

      the name (John) will be returned if its with capital J only, otherwise it will not be returned.

      šŸ™‚

  1. […] There are also other methods of dealing with SQL tasks which involves CASESPECIFIC columns.Those methods are very easily explained in Teradatatech.com. […]

Leave a Reply to fortunegodsvn Cancel reply

Your email address will not be published.

This site uses Akismet to reduce spam. Learn how your comment data is processed.