IBM PureData System for Analytics, Version 7.1

Cast conversions

You can use cast(<value> as <datatype>) to cast a data type from one type to another type. For example, you can convert any numeric data type (byteint, smallint, int, bigint, numeric/decimal, float, double) to any other numeric data type. The <value> field can be a column or an expression.

In addition to the cast function, IBM® Netezza® offers more data type conversions as described in the following table.
Table 1. Data type conversions
Data type Function
numeric to a string to_char(numeric,text)
real or double precision to a string to_char(double precisions, text)
timestamp to a string to_char(timestamp,text)
string to date to_date(text,template)
string to numeric to_number(text,template)
string to timestamp to_timestamp(text,text)
You can also convert from one date, time, or timestamp to another. For example:
NZSQL nzdw -a -x <  x.sql
To convert a timestamp to a date, use CAST. For example:
CAST(<timestamp_value> AS DATE);


Feedback | Copyright IBM Corporation 2014 | Last updated: 2014-02-28