hi
what are the differences between
bcp and bulk insert?
Thanks
ICHORHi,
BCP.EXE is a client application (even when run on the server), so it uses an
ODBC client connection, goes through Net-Library
and ODS on the server side before the rowset gets inserted in the server.
BULK INSERT is completely server side and reads the source file directly
into a rowset so it can be inserted in the database, so no client
connection, it bypasses the network (NetLibrary) and client handler (ODS) of
SQL Server.
Thanks
Hari
SQL Server MVP
"ichor" <ichor@.hotmail.com> wrote in message
news:eZLYQRBaFHA.612@.TK2MSFTNGP12.phx.gbl...
> hi
> what are the differences between
> bcp and bulk insert?
> Thanks
> ICHOR
>|||The major difference between bcp and BULK INSERT is that BULK INSERT cannot
export data whereas BCP can. Also BCP is a command line utility so you have
to use XP_CMDSHELL to use BCP and with BULK INSERT you can run in your scrip
t
window without having to drop out to command line. BULK INSERT allows you t
o
use a FORMAT file to tell process how to handle the data that is coming into
you table and you can use BCP FORMAT to create a format file to use with you
r
BULK INSERT statement.
Also BCP is a command line utillity
Below is an example of simple usage of BCP and BULK INSERT.
/* Get Details about BCP usage */
Create Table #BCP
(
info nvarchar (255)
)
Insert #BCP
EXEC xp_cmdshell 'BCP '
Select * from #BCP
Drop table #BCP
/*Bulk Insert Example */
BULK INSERT [dbo].[hard_drives]
FROM 'C:\hard_drives.txt'
WITH
(
DATAFILETYPE = 'char',
FIELDTERMINATOR = ',',
FIRSTROW = 2,
ROWTERMINATOR = '\n'
)
Hope this helps.
"ichor" wrote:
> hi
> what are the differences between
> bcp and bulk insert?
> Thanks
> ICHOR
>
>
2012年3月19日星期一
bcp or bulkinsert
标签:
bcp,
betweenbcp,
bulk,
bulkinsert,
database,
differences,
hiwhat,
microsoft,
mysql,
oracle,
server,
sql
订阅:
博文评论 (Atom)
没有评论:
发表评论