Copying Data Using bcp or BULK INSERT

The bcp utility (bulk copy program) is a command prompt utility that copies Microsoft® SQL Server™ data to or from a data file. It is used most frequently to transfer large volumes of data into a SQL Server table from another program, usually another database management system. The data to be transferred is first exported from the source program to a data file, and then imported from the data file into a SQL Server table using bcp. Alternatively, bcp can be used to transfer data from a SQL Server table to a data file for use in other programs. For example, the data can be copied from SQL Server into a data file; from there, another program can import the data.


Note The bcp utility is written using the ODBC bulk copy application programming interface (API). Earlier versions of the bcp utility were written using the DB-Library bulk copy API.


Data can also be transferred into a SQL Server table from a data file using the BULK INSERT statement; however, the BULK INSERT statement cannot bulk copy data from SQL Server to a data file. The BULK INSERT statement allows you to bulk copy data into SQL Server using the functionality of the bcp utility with a Transact-SQL statement rather than from the command prompt.

It is also possible to write programs to bulk copy SQL Server data to or from a data file using the bulk copy API. The bulk copy API can be used in ODBC, OLE DB, SQL-DMO, and DB-Library based applications.

See Also
Backward Compatibility Details (Level 2) Bulk-Copy Rowsets
Bulk-Copy Functions Performing Bulk Copy Operations
BULK INSERT BulkCopy Object

  


(c) 1988-98 Microsoft Corporation. All Rights Reserved.