C to SQL: Bit

The identifier for the bit ODBC C data type is:

SQL_C_BIT

The following table shows the ODBC SQL data types to which bit 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

SQL_WCHAR SQL_WVARCHAR

SQL_WLONGVARCHAR
None n/a
SQL_DECIMAL SQL_NUMERIC

SQL_TINYINT SQL_SMALLINT

SQL_INTEGER SQL_BIGINT

SQL_REAL SQL_FLOAT

SQL_DOUBLE
None n/a
SQL_BIT None n/a

The driver ignores the length/indicator value when converting data from the bit C data type and assumes that the size of the data buffer is the size of the bit C data type. The length/indicator value is passed in the StrLen_or_Ind argument in SQLPutData and in the buffer specified with the StrLen_or_IndPtr argument in SQLBindParameter. The data buffer is specified with the DataPtr argument in SQLPutData and the ParameterValuePtr argument in SQLBindParameter.