Subject Re: Posting Question to IBPP Discussion? 2ne Attempt.
Author pukindog_2004
--- In firebird-support@yahoogroups.com, Helen Borrie <helebor@t...>
wrote:
> At 03:06 PM 9/12/2004 +0000, you wrote:
>
>
> >Hi Folks:
> >
> >[off-topic material snipped]
> >
> > I"m using IBPP 2.3.1.1.
> >
> > How do I extract millisecond informatin from
> >a timestamp?
>
> The EXTRACT(SECOND FROM MyTimestamp) function returns the seconds as a
> DECIMAL(6,4). To compute the subsecond portion you would need to
apply the
> external (fbudf) function TRUNCATE, using an expression like
>
> EXTRACT(SECOND FROM MyTimestamp) - TRUNCATE( EXTRACT(SECOND FROM
MyTimestamp) )
>
> But there's a gotcha here. If you stored MyTimeStamp by capturing the
> system date/time (CURRENT_TIMESTAMP or CURRENT_TIME) then the subsecond
> portion is always zero. To store an exact timestamp, you need to
use the
> fbudf function GETEXACTTIMESTAMP(), which takes no arguments and
returns a
> fully-populated timestamp.

Thanks Helen:

I'm using dynamic SQL, and my INSERT statements looks like:

INSERT INTO nr_stroke_desc_table_01
(
time_stamp
)
values
(
'2004-12-03 09:39:04.546'
)

I can blow off retrieving milliseconds for now, but I do
need to be saving them. Does this construct do that?

Thanks
Larry