Wednesday, October 2, 2013

Create Netezza TIMESTAMP with fractional seconds



Observe, the timestamp mask definition: "... hh24:mi:ss.MS" and "...hh24:mi:ss.US"

--- Testing timestamps with fractional seconds at Netezza ---
create table xxxtab (test_name varchar(30),the_timestamp timestamp);

insert into xxxtab values('current_timestamp',current_timestamp);

insert into xxxtab values('converted timestamp',to_timestamp('2013-01-01 00:01:59','YYYY-MM-DD HH24:MI:SS'));

insert into xxxtab values('with mili seconds',to_timestamp('2013-01-01 00:01:59.999','YYYY-MM-DD HH24:MI:SS.MS'));

insert into xxxtab values('with micro seconds',to_timestamp('2013-01-01 00:01:59.99999','YYYY-MM-DD HH24:MI:SS.US'));

SELECT test_name, to_CHAR(the_timestamp,'YYYY-MM-DD HH24:MI:SS.US'from xxxtab order by createxid;




No comments:

Post a Comment