Sunday, October 31, 2010

Forcing Case Sensitivity in Teradata

Teradata is by default case insensitive. But there are certain scenarios that you might face, where you want the WHERE clause to check only for the pattern in the specified case. This is how you achieve it: by adding a predicate to the constraint (CASESPECIFIC)

Eg:

SELECT CURRENT_DATE
WHERE
UPPER('hello') = 'hello' (CASESPECIFIC); --will not return the current_date

SELECT CURRENT_DATE
WHERE
LOWER
('HELLO') = 'hello' (CASESPECIFIC); --will return the current_date

(Please leave a comment if you find my posts helpful)

4 comments:

  1. In the first query...you are trying to match 'HELLO' with 'hello' which is not possible. Change it to SELECT CURRENT_DATE
    WHERE
    UPPER('hello') = 'HELLO' (CASESPECIFIC)

    ReplyDelete
  2. yes, JJ. Please look at my comment, I intend it to fail to show the significance of the function.

    Thanks,
    Meena

    ReplyDelete
  3. Hi Meena,i am teradata DBA (admin).Is basically teradata is a case sensitive? And how many characters we can give as a password in teradata?

    ReplyDelete
  4. Hi Vasudeva, teradata is not case sensitive. That is why there is a need to Force case sensitivity when required, while querying. I am not sure if there are password restrictions on number of characters, I can look it up and get back

    ReplyDelete