Home Page for the TeradataForum

Archives of the TeradataForum

Message Posted: Fri, 13 Jul 2001 @ 14:22:32 GMT

  <Prev Next>   <<First <Prev Next> Last>>  

Subj:   Re: Current_timestamp Question
From:   Geoffrey Rommel

  When INSERTing a CURRENT_TIMESTAMP into a column mark defined as TIMESTAMP(6), it appears to not utilize the complete microseconds, last 6 positions, to its fullest potential. In other words it will insert 130000 instead of 138372 in the last 6 positions. Any way to get this to utilize all 6 positions? How does Teradata come up with the microseconds??  

The short answer to your question is no. Or yes, it is using all 6 positions, but the last 4 are always 0.

There are a couple of things to note here.

- TIME and TIMESTAMP are ANSI constructs. They have been defined as having a maximum of 6 decimal places because many DBMSes, including DB2 on OS/390, can indeed capture time down to the microsecond. However, not every DBMS is required to meet this standard.

- The resolution you can actually get depends on the hardware and the operating system support. Our system is running on NCR WorldMark with MP-RAS; on this system, there is no way to get anything below centiseconds. Under NT or Solaris, there may be.

The following C program, run on an application node, will show you exactly what the OS provides.

=== gtod.c ===

int main (
  int    argc,
  char **argv )
 struct timeval right_now;


 printf("Time of day is %ld seconds, %ld microseconds\n",
     right_now.tv_sec, right_now.tv_usec);

 return 0;

=== compile ===
cc -ogtod gtod.c

=== run ===
$ gtod
Time of day is 995033602 seconds, 120000 microseconds
$ gtod
Time of day is 995033605 seconds, 450000 microseconds
$ gtod
Time of day is 995033606 seconds, 510000 microseconds

  <Prev Next>   <<First <Prev Next> Last>>  
  Top Home Privacy Feedback  
Copyright for the TeradataForum (TDATA-L), Manta BlueSky    
Copyright 2016 - All Rights Reserved    
Last Modified: 28 Jun 2020