ASQL_AUTO_DATE_FORMAT

Inserting dates with an ODBC driver requires those dates to be in YYYY-MM-DD format. If your dates do not follow this format, an error can be produced, depending on the ODBC driver you are using: SQL Server Native Client 11.0 and later enforce this format (and so produce an error), whereas previous SQL drivers do not.

To mitigate the need to modify your programs, you can use this variable, which will update your dates to the required format before they are written to the SQL Server database. However, if possible, you should modify your COBOL programs so that date values are in YYYY-MM-DD format before being sent to the AcuSQL driver; thus, no relying on this variable.

When set to TRUE, this variable attempts to automatically format the inserts to a DATE column to the YYYY-MM-DD format. It is only used if:
  • Source is a PIC X(n) data type
  • Target is a DATE type
  • Length of the source (n) is not correct for a DATE column (which, at the time of writing, is 10)

For example, if these conditions are met, a value of 12345678 is modified to 1234-56-78. There is no mechanism to specify another format for the date (for example, YYYYMMDD vs DDMMYYYY).

The default value of this variable is FALSE, to preserve historical behavior.