Finding if a field contains all numeric values using Teradata SQL
How to find if the data contained in a character-type field is all numeric.
The column contains the following records:
There are three methods to achieve this:
- TD15.10 supports a
TRYCAST('ABC' AS INT)which returns NULL when the cast fails.
TO_NUMBER('ABC')also returns NULL for bad data
- try - where upper(column_name) <> lower(column_name);
Enjoy great content like this and a lot more !
Signup for a free account to write a post / comment / upvote posts. Its simple and takes less than 5 seconds