11 July 2018        Add to Favorites   Report

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: '001' and 'ABC'


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);

Read great educational content like this and a lot more ! Create my free account now 🎁