Saturday, July 4, 2015

Differences between BCP and Bulk Insert

The bcp command prompt utility 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 (DBMS). The data 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 an instance of SQL Server into a data file. From there, another program can import the data.
  • BCP is a command prompt utility
  • BCP is more configurable
  • BCP used to transfer the data into data file with complete table or you can use query to be data transfer from table to file. File may be text file or CSV and also you can give the formatting also.
  • Less parsing efforts/cost, and no string to data type conversions!
  • Always uses Net Library
  • Version switch for down level native and char formats
Bulk Insert
  • Fastest way to load data into SQL server
  • cannot bulk copy data from an instance of SQL Server to a data file but bcp can do both ways
  • BULK INSERT is “in memory”
  • Server based-Streams rowset directly in to server
  • No support for down level version input (native) data formats (no -V)
  • If table has existing data and is a HEAP, BULK INSERT starts on new extent to provide lightweight ROLLBACK
  • Ordered input data
  • Both are single threaded Only run on one CPU( No parallel operations)

No comments:

Post a Comment