Subject | Re: [firebird-support] TimeStamp(3) equivalent |
---|---|
Author | Helen Borrie |
Post date | 2009-03-25T21:41:16Z |
At 07:48 AM 26/03/2009, you wrote:
update something
set afield = something,
timefield = current_timestamp
then all affected rows will have the same time stamp.
A statement like
for .....
do begin
if (whatever) then
update something
set afield = :somevariable,
timefield = current_timestamp
where (condition to pin a single row) ;
end
... then the timestamp potentially changes at each turn of the loop.
The time literal 'NOW' records exact moment in time under all conditions, so
update something
set afield = something,
timefield = cast ('NOW' as timestamp)
potentially records a progressively later timestamp for each row written to.
./heLen
>Is there a TimeStamp(3) equivalent for 'now' >'NOW' and CURRENT_TIMESTAMP are timestamp(3) by default in Fb 2 and above. To make them otherwise, you would cast them.
>Since TimeStamp reflects the time a procedure starts andNot quite. CURRENT_TIMESTAMP is the time a DML statement starts executing, so it resets to the latest time each time a DML statement request is freshly executed. Thus, if your SP includes a statement
>'now' is the 'cpu time ??'
update something
set afield = something,
timefield = current_timestamp
then all affected rows will have the same time stamp.
A statement like
for .....
do begin
if (whatever) then
update something
set afield = :somevariable,
timefield = current_timestamp
where (condition to pin a single row) ;
end
... then the timestamp potentially changes at each turn of the loop.
The time literal 'NOW' records exact moment in time under all conditions, so
update something
set afield = something,
timefield = cast ('NOW' as timestamp)
potentially records a progressively later timestamp for each row written to.
./heLen