Subject | Re: [firebird-support] NOW and CURRENT_TIME_STAMP |
---|---|
Author | Kevin Lingofelter |
Post date | 2004-09-23T19:50:19Z |
Excellent. Thanks!
Kevin Lingofelter
On Thu, 23 Sep 2004 21:46:06 +0200, Ivan Prenosil
<ivan.prenosil@...> wrote:
Kevin Lingofelter
On Thu, 23 Sep 2004 21:46:06 +0200, Ivan Prenosil
<ivan.prenosil@...> wrote:
> > These appear to return the same value. Is one different from the other
> > and/or is one preferred over the other?
>
> CURRENT_TIMESTAMP is system variable that returns
> 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
>
>
>
> Yahoo! Groups Links
>
>
>
>
>