---
title: "C to SQL: Binary | Microsoft Docs"
ms.custom: ""
ms.date: "01/19/2017"
ms.prod: sql
ms.prod_service: connectivity
ms.reviewer: ""
ms.technology: connectivity
ms.topic: conceptual
helpviewer_keywords:
- "binary data type [ODBC]"
- "data conversions from C to SQL types [ODBC], binary"
- "binary data transfers [ODBC]"
- "converting data from c to SQL types [ODBC], binary"
ms.assetid: 3e9083f3-357b-41aa-833c-2c8aac2226cd
author: David-Engel
ms.author: v-daenge
---
# 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](../../../odbc/reference/appendixes/converting-data-from-c-to-sql-data-types.md).
|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|