Subject Re: [firebird-support] Context variables
Author Nick Upson
In article <007201c5288a$5329e6a0$0c0110ac@prenosil>, Ivan Prenosil wrote:
> > Am I correct in thinking that these are equivalent line of code (given both
> > dt1 & dt2 are defined as date (dialect1) and timestamp (dialect3):
> >
> > dt1 = CURRENT_TIMESTAMP;
> >
> > dt2 = CAST(CAST ('NOW' AS VARCHAR(11)) as DATE);
>
> No.

Thanks for the response:

> * First one will return timestamp (i.e. date+time),
> the second one just date.

I understand that in dialect 3 but in dialect 1 I thought they would produce the
same

> * First one is evaluated only once for each statement,
> the second one everytime the expression is evaluated.

understood

> * 'NOW' is CHAR(3) string, there is no reason to cast it to VARCHAR(11).
> This is enough:
> dt2 = CAST('NOW' as DATE);

for dialect 1, I thought I was getting the date (NOW), chopping off the time
portion (varchar 11) and then making it into a date again

--
Nick
-----We Solve your Computer Problems---
Founder & Listowner of the Prolifics User Group
Panther, Ingres, UNIX, Interbase, Firebird - Available Shortly