Link to home
Start Free TrialLog in
Avatar of JeepGeekin
JeepGeekin

asked on

Teradata IsNumeric

Does anyone know a way to filter out non-numeric characters in a char field?

I am looking for something like the following that works with Teradata:
Select * from table where IsNumeric(field1) = 1

I have a problem converting a string to an integer on a field that "should" contain all numbers, but it doesn't. Or if there's any way to not get a blasted "Bad Character in format or data" error whenever I try to convert the field to an integer.
ASKER CERTIFIED SOLUTION
Avatar of rockiroads
rockiroads
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of JeepGeekin
JeepGeekin

ASKER

Thanks! I don't have the ability to add UDFs to this system, but the Upper approach worked for all characters but the "~", "`", "@","#","$", ...
Then I just filter thi smuch smaler list out. Also, I had to add a lower statement & a casespecific statement:

select * from Upper(field) <> Lower(Field) (CASESPECIFIC)

Thanks again!

Cool and thanks for posting your solution, be very useful for others in the same predicament

:)

Best of luck with the rest of your project
OK. I feel stupid, so I'll post this as well. The Between statement can still recognize numeriic ranges when dealing with characters. This is probably the best way to handle this:

Select * from table where trim(field) BETWEEN '0' AND '99999'

(use as many 9's as you need)