%ODBCOUT returns expression in the ODBC format after passing the value through the field or data type’s LogicalToOdbc method. The ODBC format is the format in which data can be presented via ODBC. This format is used when data is exposed to ODBC/SQL. The available formats correspond to those defined by ODBC.
%ODBCOUT is commonly used on a SELECT list select-item. It can be used in a WHERE clause, but this use is discouraged because using %ODBCOUT prevents the use of indexes on the specified field.
Applying %ODBCOUT changes the column header name to a value such as “Expression_1”; it is therefore usually desirable to specify a column name alias, as shown in the examples below.
Whether %ODBCOUT converts a date depends on the data type returned by the date field or function. %ODBCOUT converts CURDATE, CURRENT_DATE, CURTIME, and CURRENT_TIME values. It does not convert CURRENT_TIMESTAMP, GETDATE, GETUTCDATE, NOW, and $HOROLOG values.
%ODBCOUT is an InterSystems SQL extension.
For further details on display format options, refer to “Data Display Options” in the “InterSystems IRIS SQL Basics” chapter of Using InterSystems SQL.