Skip to content

Latest commit

 

History

History
61 lines (41 loc) · 4.97 KB

File metadata and controls

61 lines (41 loc) · 4.97 KB
title Performing Bulk Copy Operations (ODBC)
description Learn how the SQL Server Native Client ODBC driver supports DB-Library functions that perform SQL Server bulk copy operations.
author markingmyname
ms.author maghan
ms.date 03/16/2017
ms.service sql
ms.subservice native-client
ms.topic reference
helpviewer_keywords
SQL Server Native Client ODBC driver, bulk copy
bulk copy [ODBC]
ODBC, bulk copy operations
minimally logged operations [SQL Server Native Client]
bulk copy [ODBC], about bulk copy

Performing Bulk Copy Operations (ODBC)

[!INCLUDESQL Server Azure SQL Database Synapse Analytics PDW]

The ODBC standard does not directly support [!INCLUDEssNoVersion] bulk copy operations. When connected to an instance of [!INCLUDEssNoVersion] version 7.0 or later, the [!INCLUDEssNoVersion] Native Client ODBC driver supports the DB-Library functions that perform [!INCLUDEssNoVersion] bulk copy operations. This driver-specific extension provides an easy upgrade path for existing DB-Library applications that use bulk copy functions. The specialized bulk copy support is in the following files:

  • sqlncli.h

    Includes function prototypes and constant definitions for bulk copy functions. sqlncli.h must be included in the ODBC application performing bulk copy operations and must be in the application's include path when it is compiled.

  • sqlncli11.lib

    Must be in the library path of the linker and specified as a file to be linked. sqlncli11.lib is distributed with the [!INCLUDEssNoVersion] Native Client ODBC driver.

  • sqlncli11.dll

    Must be present at execution time. sqlncli11.dll is distributed with the [!INCLUDEssNoVersion] Native Client ODBC driver.

Note

The ODBC SQLBulkOperations function has no relationship to the [!INCLUDEssNoVersion] bulk copy functions. Applications must use the [!INCLUDEssNoVersion]-specific bulk-copy functions to perform bulk copy operations.

Minimally Logging Bulk Copies

With the Full Recovery model, all row-insert operations performed by bulk load are fully logged in the transaction log. For large data loads, this can cause the transaction log to fill rapidly. Under certain conditions, minimally logging is possible. Minimal logging reduces the possibility of a bulk load operation filling the log space and is also more efficient than full logging.

For information on using minimal logging, see Prerequisites for Minimal Logging in Bulk Import.

Remarks

When using bcp.exe in [!INCLUDEssVersion2005] or later, you might see errors in situations where there were no errors prior to [!INCLUDEssVersion2005]. This is because in the later versions, bcp.exe no longer performs implicit data type conversion. Prior to [!INCLUDEssVersion2005], bcp.exe converted numeric data to a money data type, if the target table had a money data type. However, in that situation, bcp.exe simply truncated extra fields. Beginning in [!INCLUDEssVersion2005], if data types do not match between the file and the target table, bcp.exe will raise an error if there is any data that would have to be truncated to fit into the target table. To resolve this error, fix the data to match the target data type. Optionally, use bcp.exe from a release prior to [!INCLUDEssVersion2005].

In This Section

See Also

SQL Server Native Client (ODBC)
Bulk Import and Export of Data (SQL Server)