All Forums General
Purushotham 87 posts Joined 04/14
25 Jun 2014
I have alpanumeric,character and interger values in my column,by using case i want to char values as 'C',int values as 'I'.
Purushotham.M
Raja_KT 1246 posts Joined 07/09
25 Jun 2014

Will this help you?
http://forums.teradata.com/forum/database/numeric-or-non-numeric-values

Raja K Thaw
My wiki: http://en.wikipedia.org/wiki/User:Kt_raj1
Street Children suffer not by their fault. We can help them if we want.

Qaisar Kiani 337 posts Joined 11/05
25 Jun 2014

Which database version you are using? Did you try using regular expressions?

Purushotham 87 posts Joined 04/14
26 Jun 2014

Hi,

I am using 13.0,but I tried not working...
I have int values,character and alpa numeric values in my column.
But I want to display int values as 'I' and alpa numeric values as 'AN' and char values as 'C'.By using case statement how can we display?

Purushotham.M

dnoeth 4628 posts Joined 11/04
26 Jun 2014

Hi Purushotham,
without UDF or RegEx there's no easy way to determine that.
You could create a monster CASE to check each character for it's character class:

CASE WHEN SUBSTRING(col FROM 1 FOR 1) NOT BETWEEN '0' AND '9'
       OR SUBSTRING(col FROM 2 FOR 1) NOT BETWEEN '0' AND '9'
       OR SUBSTRING(col FROM 3 FOR 1) NOT BETWEEN '0' AND '9'
       ...
     THEN 'C'

 

Dieter

You must sign in to leave a comment.