Subject RE: [firebird-support] Context variables
Author Alan McDonald
> In article <00bd01c52896$52a33400$0c0110ac@prenosil>, Ivan Prenosil wrote:
> > > From: "Dimitry Sibiryakov"
> > > On 14 Mar 2005 at 13:33, Ivan Prenosil wrote:
> > >
> > >>To strip-off time portion from timestamp, you have to convert
> > >>string 'NOW' to timestamp, get first 11 characters,
> > >>then convert it back. This will work in both dialects:
> > >> CAST(CAST(CAST ('NOW' AS DATE) AS VARCHAR(11)) AS DATE)
> > >
> > > AFAIK, CAST cannot truncate string. You'll get 'String truncation'
> > > error, no?
> >
> > Normally no, but if it is part of converting from
> Timestamp/Date to (Var)Char
> > then it works - just try it. (it is for compatibility reasons
> with older IB)
>
> d_from is timestamp in dialect3 database inside an SP
>
> d_from = '31.12.2004 13:45:17';
> d_from = CAST(CAST (d_from AS VARCHAR(11)) as DATE);
>
> gives truncation error (I want just the date portion of the
> initial contents)
>
> --
> Nick

what about CAST (d_from AS DATESTAMP)