Subject | Re: [firebird-support] NOW and CURRENT_TIME_STAMP |
---|---|
Author | Ivan Prenosil |
Post date | 2004-09-23T19:46:06Z |
> These appear to return the same value. Is one different from the otherCURRENT_TIMESTAMP is system variable that returns
> and/or is one preferred over the other?
value of TIMESTAMP datatype. The value is constant
during single command execution, i.e. even if this command will run for hours
UPDATE tab SET x=CURRENT_TIMESTAMP;
all values in X column will be equal.
'NOW' is *string*, that Firebird is able to convert to Timestamp datatype
(either explicitely, using CAST, or in some situations implicitely).
The value is evaluated everytime the value is used, i.e.
UPDATE tab SET x='NOW';
values in X column are *not* guaranteed to be the same.
You can execute
UPDATE tab SET x=CURRENT_TIMESTAMP + 1;
but not
UPDATE tab SET x='NOW' + 1;
since it means adding 1 to string; explicit cast has to be used here
UPDATE tab SET x=CAST('NOW' AS TIMESTAMP) + 1;
Ivan