Re: Date String Conversion error
Posted in 1997
>From: Ernest Chen <chen@www.kaplan.com>
>Date: Tue, 21 Jan 1997 12:04:46 -0500
>X-Informix-List-Id: <news.32827>
>
>The document for Online Server v7.1 says I can do this:
>
>insert into mytable (subscription_date, email)
>values('1997-01-11 08:45', "hello");>
>subscription_date has a data type of 'date'
>
>I received date string conversion error, can anybody help??
Please quote the manual name and page reference -- I looked in the 7.1
Informix Guide to SQL: Syntax under INSERT and could not find an example
which matches your code...
Your code is using a literal which is in the correct format for DATETIME,
but is a character string, not a DATETIME value. Even with DBDATE="y4md-",
you would get a conversion error because of the time component. To insert
that value into a DATE field, you would need to use:
CREATE TEMP TABLE t (d DATE NOT NULL);
INSERT INTO t VALUES(DATETIME(1997-01-11 08:45) YEAR TO MINUTE);
Given a DATETIME value, the engine will convert it to a DATE for you. But
it cannot convert the string you supplied.
Yours,
Jonathan Leffler (johnl@informix.com) #include <disclaimer.h>