Hi! I'm trying to assign a DEFAULT to a DATETIME values of something other than CURRENT, and can't figure out what I am doing wrong.
First of all, I have the following environment variable set:
GL_DATETIME=%Y%m%d %T.%F3
so my value for right now, for instance would be
20021219 19:17:38.456
if I had stamped a record with current and then queried it.
I'm trying to set up a table with DEFAULT values like this:
CREATE TABLE t_system_config (
config_type_id INTEGER NOT NULL REFERENCES t_config_type(config_type_id)
CONSTRAINT fk_system_config1,
dt_eff_end DATETIME YEAR TO FRACTION
DEFAULT '20991231 23:59:59.999' NOT NULL,
dt_eff_begin DATETIME YEAR TO FRACTION
DEFAULT '20010101 00:00:00.001' NOT NULL,
cfg_type_char1 NCHAR(10),
cfg_type_int1 INTEGER,
cfg_type_double1 FLOAT,
dt_last_update DATETIME YEAR TO FRACTION DEFAULT CURRENT NOT NULL,
PRIMARY KEY (config_type_id, dt_eff_end) CONSTRAINT pk_system_config
);
I have tried single quotes, parens, and both in combination (started with none of the above)
and what I get is:
CREATE TABLE t_system_config (
config_type_id INTEGER NOT NULL REFERENCES t_config_type(config_type_id)
CONSTRAINT fk_system_config1,
dt_eff_end DATETIME YEAR TO FRACTION
DEFAULT '20991231 23:59:59.999' NOT NULL,
# ^
# 591: Invalid default value for column/variable (dt_eff_end).
#
dt_eff_begin DATETIME YEAR TO FRACTION
DEFAULT '20010101 00:00:00.001' NOT NULL,
cfg_type_char1 NCHAR(10),
cfg_type_int1 INTEGER,
cfg_type_double1 FLOAT,
dt_last_update DATETIME YEAR TO FRACTION DEFAULT CURRENT NOT NULL,
PRIMARY KEY (config_type_id, dt_eff_end) CONSTRAINT pk_system_config
);
Has anyone done this successfully? There has to be some kind of trick, but none of the manuals nor the Informix Handbook has helped. I have setup no hidden constraints on DATETIME values in the database, either.
Please help me if you know to solve this one. Thanks!