IS INGRESDATE, IS ANSIDATE Predicates
Use these predicates to determine if a result can be assigned to a column of the given data type without loss of data. They are especially useful for cleaning data or validating data input. When applied to row value expressions, all elements must test the same.
These predicates take the following form:
IS [NOT] INGRESDATE
IS [NOT] ANSIDATE
For example:
SELECT 'date' IS INGRESDATE
is true if date is INGRESDATE in form.
If all values in a column pass this predicate, then the whole column can be coerced into an INGRESDATE column.
For example, the following returns "Invalid":
SELECT CASE WHEN 'abc' IS INGRESDATE THEN 'Valid' ELSE 'Invalid' END
INGRESDATE columns can also be checked, such as with this query that identifies any rows that could not be converted to an ANSIDATE:
SELECT val FROM table WHERE val IS NOT ANSIDATE
Last modified date: 12/20/2023