Skip to content

Latest commit

 

History

History
33 lines (27 loc) · 1.89 KB

sql-to-c-bit.md

File metadata and controls

33 lines (27 loc) · 1.89 KB
title SQL to C: Bit
description SQL to C: Bit
author David-Engel
ms.author v-davidengel
ms.date 01/19/2017
ms.service sql
ms.subservice connectivity
ms.topic reference
helpviewer_keywords
converting data from SQL to c types [ODBC], bit
bit data type [ODBC]
data conversions from SQL to C types [ODBC], bit

SQL to C: Bit

The identifier for the bit ODBC SQL data type is:

SQL_BIT

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

C type identifier Test *TargetValuePtr *StrLen_or_IndPtr SQLSTATE
SQL_C_CHAR

SQL_C_WCHAR
BufferLength > 1

BufferLength <= 1
Data

Undefined
1

Undefined
n/a

22003
SQL_C_STINYINT

SQL_C_UTINYINT

SQL_C_TINYINT

SQL_C_SBIGINT

SQL_C_UBIGINT

SQL_C_SSHORT

SQL_C_USHORT

SQL_C_SHORT

SQL_C_SLONG

SQL_C_ULONG

SQL_C_LONG

SQL_C_FLOAT

SQL_C_DOUBLE

SQL_C_NUMERIC
None[a] Data Size of the C data type n/a
SQL_C_BIT None[a] Data 1[b] n/a
SQL_C_BINARY BufferLength >= 1

BufferLength < 1
Data

Undefined
1

Undefined
n/a

22003

[a] The value of BufferLength is ignored for this conversion. The driver assumes that the size of *TargetValuePtr is the size of the C data type.

[b] This is the size of the corresponding C data type.

When bit SQL data is converted to character C data, the possible values are "0" and "1".