Re: DEFAULT value for a DATETIME Column
Posted in 1997
Bappy wrote:
}
} I am have problem running the following statement
}
} CREATE TABLE XX
} (
} XX_ID CHAR(30) NOT NULL,
} XX_NM CHAR(30) DEFAULT 'DEMOGRAPHICS UNAVAILABLE ',
} XX_STA_DT DATETIME YEAR TO DAY DEFAULT '1997-01-23',
} XX_MAX_PMT_AMT DECIMAL(9,0) DEFAULT -1,
} XX_INCL CHAR(1) DEFAULT 'Y'
} )
} ;
}
} It error's out and complains that '1997-01-23' is not in a valid
} format. I gave tried a several other format's i.e. '1997/01/23'.
} Nothing seem to work.
}
} I am running this from a dbaccess session and unsing Informix Online
} 7.1.
}
} Idea anyone?
}
} Thanx.
}
} Bappy
In Informix Guide to SQL: Syntax Version 6.0, pg 1-89, section Literal
Terms as Default Values states:
"Characters must be enclosed in quotation marks. Date literals must be
of the format specified by the DBDATE environment variable. If DBDATE is
not set, the format mm/dd/yyyy is assumed."
Check if you have DBDATE set; if so, conform to the format specified.
Else, use:
...
XX_STA_DT DATETIME YEAR TO DAY DEFAULT '01/23/1997',
...
Hope this helps.
--
+--------------------------------------------------------------------+
| Name : Edmund Nigel Gall Address: 9A Stanmore Avenue |
| Title : Account Executive Port of Spain |
| Company : Stratis Caribbean Ltd. Trinidad & Tobago, W.I. |
| |
| Contact Information: |
| Office Personal |
| Voice : (809) 623 6530/1 (809) 662 6611 |
| Fax : (809) 623 8370 (809) 662 6611 |
| Email : ngall@stratis-caribbean.com nigelg@trinidad.net |
+----------------- http://www.stratis-caribbean.com -----------------+