C to SQL: Binary

The identifier for the binary ODBC C data type is:

SQL_C_BINARY

The following table shows the ODBC SQL data types to which binary C data may be converted. For an explanation of the columns and terms in the table, see Converting Data from C to SQL Data Types.

SQL type identifier Test SQLSTATE
SQL_CHAR

SQL_VARCHAR

SQL_LONGVARCHAR
Byte length of data <= Column byte length

Byte length of data > Column byte length
n/a

22001
SQL_WCHAR

SQL_WVARCHAR

SQL_WLONGVARCHAR
Character length of data <= Column character length

Character length of data > Column character length
n/a

22001
SQL_DECIMAL

SQL_NUMERIC

SQL_TINYINT

SQL_SMALLINT

SQL_INTEGER

SQL_BIGINT

SQL_REAL

SQL_FLOAT

SQL_DOUBLE

SQL_BIT SQL_TYPE_DATE

SQL_TYPE_TIME

SQL_TYPE_TIMESTAMP
Byte length of data = SQL data length

Byte length of data <> SQL data length
n/a

22003
SQL_BINARY

SQL_VARBINARY

SQL_LONGVARBINARY
Length of data <= column length

Length of data > column length
n/a

22001