Subject Re: [firebird-support] Conversion error from string "NOW"
Author Helen Borrie
At 06:28 PM 8/10/2004 +0200, you wrote:

>Hi,
>
>When updating a VARCHAR(30) field I get an errormessage: conversion
>error from string "NOW".
>What does a "conversion error from string" generally mean? And
>specifically, what does "NOW" mean in this respect?

If the engine is asked to do an implicit or explicit cast from a string
type to another type, you will get this error message if the string data
can't be converted.

'NOW' is a predefined date literal - a special group of string literals
representing a range of date/time types. The engine translates 'NOW' to a
TIMESTAMP type if you ask the right way.

update myTable
set MyVarchar30 = 'NOW'

should store the word "NOW" without exceptions. (It will cause the
conversion error in IB 5.x and below, though.

UPDATE myTable
setMyVarchar30 = 'NOW'
will store the word 'NOW'.

Explicit cast:

update myTable
set MyVarchar30 = CAST (CAST ('NOW' AS TIMESTAMP) AS VARCHAR(30) )
stores a string like '2004-10-09 10:02:44.0000'

Implicit cast:

update myTable
set MyVarchar30 = CAST ('NOW' AS TIMESTAMP)
will store '2004-10-09 10:02:44.0000'

So - show us the actual statement that failed.

It makes a difference what version and brand of server you're using, too,
so mention that.

./heLen