Informix Error -2867: The CURRENT attribute may be assigned only to datetime columns.
Cause and resolution
The CURRENT attribute may be assigned only to datetime columns.
The CURRENT function (not attribute) produces the current date and time as a DATETIME value, but the field that is referenced in this statement does not have the DATETIME data type. Automatic data conversion is not supported in this context. Review the statement to make sure that it refers to the field that you intended, and revise the form to assign DATETIME values only to DATETIME fields.
Oninit® Troubleshooting Guidance
Reasons / Common Causes
-2867 fires when the CURRENT function is assigned to a field that isn't DATETIME — per the
official guidance, CURRENT produces the current date and time as a DATETIME value, and
automatic data conversion isn't supported in this context.
CURRENTassigned to a non-DATETIMEfield, per the official guidance — the direct, only cause.
Solutions / Resolution
- Review the statement to confirm it refers to the field you intended, per the official guidance.
- Revise the form to assign
CURRENT/DATETIMEvalues only toDATETIMEfields, per the official guidance.
Examples
CURRENT on a non-DATETIME field
ATTRIBUTES
status = order_status, DEFAULT = CURRENT;
-- -2867: order_status is CHAR, not DATETIME
Corrected
ATTRIBUTES
order_timestamp = order_timestamp, DEFAULT = CURRENT;
Diagnostic Checks
- Check the declared type of any field assigned
CURRENT, and confirm it'sDATETIME.
Related Errors / Related Topics
- -2866 — "The NOW attribute may be assigned only to datetime columns." A legacy sibling
error for the no-longer-existent
NOWattribute, whichCURRENTreplaced. - -2856 — "The TODAY attribute may be assigned only to date columns." The same
no-auto-conversion rule applied to
TODAY/DATEinstead ofCURRENT/DATETIME.
CURRENT was assigned to a non-DATETIME field — forms don't auto-convert it.