[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 3977
  • Last Modified:

bcp Vs Bulk Insert

What is the difference between bcp(Bulk Copy Program) and Bulk Insert in MS-SQL?
0
sti2006
Asked:
sti2006
2 Solutions
 
sti2006Author Commented:
Not Yet Found Any Answer
0
 
Aneesh RetnakaranDatabase AdministratorCommented:
Hi sti2006,

1.BCP : is a command prompt utility
2.  BULK INSERT statement cannot bulk copy data from an instance of SQL Server to a data file.
3.


Aneesh
0
 
Aneesh RetnakaranDatabase AdministratorCommented:
BULK INSERT is “in memory”
BCP is more configurable
Both are single threaded
Only run on one CPU( No parallel operations)
0
Fill in the form and get your FREE NFR key NOW!

Veeam is happy to provide a FREE NFR server license to certified engineers, trainers, and bloggers.  It allows for the non‑production use of Veeam Agent for Microsoft Windows. This license is valid for five workstations and two servers.

 
Ved Prakash AgrawalDatabase Consultant/Performance ArchitectCommented:
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.


BULK insert used to copy data from files to database tables.

0
 
csachdevaCommented:
BCP

Using ODBC BCP API in 7.0 and 2000
Native format is most optimal
Less parsing efforts/cost
No string to data type conversions!
Use load hints:
Import & Export
IN | OUT | QUERYOUT
Local or Remote
Always uses Net Library
Version switch for down level native and char formats


Bulk Insert

“Fastest” way to load data into SQL Server
Everything is in-process with SQL Server
If table has existing data and is a HEAP, BULK INSERT starts on new extent to provide lightweight ROLLBACK
Ordered input data
Bulk Insert uses 1 Thread per CPU
Connections affinities to a UMS scheduler
Import only
Server based
Streams rowset directly in to server
No support for down level version input (native) data formats (no -V)

Regards,
Chetan Sachdeva
0
 
Eugene ZCommented:
BULK INSERT <=> BCP .. IN


Using bcp and BULK INSERT
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/adminsql/ad_impt_bcp_2e5s.asp

the BULK INSERT statement cannot bulk copy data from an instance of SQL Server to a data file. The BULK INSERT statement allows you to bulk copy data to an instance of SQL Server using the functionality of the bcp utility with a Transact-SQL statement, rather than from the command prompt.

check the article
SQL Server 2005 Books Online  
Introducing bcp, BULK INSERT, and OPENROWSET(BULK)  

http://msdn2.microsoft.com/en-us/library/ms175915.aspx

-------------
also:
BULK INSERT
Copies a data file into a database table or view in a user-specified format.

Remarks
The BULK INSERT statement can be executed within a user-defined transaction. Rolling back a user-defined transaction that uses a BULK INSERT statement and BATCHSIZE clause to load data into a table or view using multiple batches rolls back all batches sent to SQL Server.

Permissions
Only members of the sysadmin and bulkadmin fixed server roles can execute BULK INSERT.
---------------------

0
 
Ved Prakash AgrawalDatabase Consultant/Performance ArchitectCommented:
BCP use for Creating data file into file system

BULK INSERT use for importing data from data file which is in file system
0

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now