Teradata ISNULL Alternatives

Raymond Tang Raymond Tang 0 5930 3.38 index 9/8/2020

In SQL Server, ISNULL function is commonly used to populate a value for null columns.  In Teradata, there is no ISNULL function but COALESCE and CASE WHEN can be used as alternatives.

Use COALESCE function

SELECT COALESCE(NULL,'ABC','CDE');

Result:

ABC

Apply to a column or expression

SELECT COALESCE(Col1, Col2,'DEFAULT') FROM DatabaseName.TableName;

Use CASE WHEN statement

SELECT CASE WHEN Col IS NULL THEN 'DEFAULT' ELSE Col END FROM DatabaseName.TableName;

Remember to change database, table and column names accordingly.

sql teradata teradata-functions

Join the Discussion

View or add your thoughts below

Comments