Inserting datetime values into an informix table fails

stb picture stb · Jul 20, 2012 · Viewed 21.8k times · Source

I am trying to insert a test value '10.06.2011 10:24' into an informix 7.3(sadly) database. The destination column is

  • System.DateTime
  • length:16
  • precision 10

while these work

select  to_date('10.06.2011 10:24', "%d.%m.%Y %H:%M") from test;
INSERT into test values('10.06.2011')

these aren't

insert into test values('10.06.2011 10:24');
insert into test values(to_date('10.06.2011 10:24:00', "%d.%m.%Y %H:%M"))

I tried several more thing like adding secounds but none if it worked. All i get as error is a syntax error without any detail on where it is.

Any suggestions are appreciated.

Answer

Frank R. picture Frank R. · Jul 20, 2012

The format of your date part, 10.06.2011, you're trying to insert into the DATETIME column is wrong.

The accepted format, using your example, is: 2011-10-06 10:24:00