Explicit data type conversion function

The driver supports explicit data type conversion with the CONVERT function, which transforms values between different SQL data types.

The function converts value_exp to the specified data type and returns the result.

CONVERT(value_exp, data_type)

The data type must be one of the following:

  • Numeric: SQL_BIGINT, SQL_DECIMAL, SQL_DOUBLE, SQL_FLOAT, SQL_INTEGER, SQL_NUMERIC, SQL_REAL, SQL_SMALLINT, SQL_TINYINT.
  • Character: SQL_CHAR, SQL_VARCHAR, SQL_WCHAR, SQL_WVARCHAR, SQL_LONGVARCHAR, SQL_WLONGVARCHAR.
  • Binary: SQL_BINARY, SQL_VARBINARY, SQL_LONGVARBINARY.
  • Date/time: SQL_DATE, SQL_TIME, SQL_TIMESTAMP.

  • Other: SQL_BIT, SQL_GUID.

For more information about the CONVERT function, see the Microsoft ODBC documentation.