problem with bulk insert


i have following code:

create table csvtest

(id int,

firstname varchar(40),

lastname varchar(40),

birthdate smalldatetime)

go 



bulk

insert csvtest

from 'c\data\tempfile.txt'

with

(

fieldterminator = ',',

rowterminator = '\n'

)

go

 

but error when try use it.
error follows:
msg 4861, level 16, state 1, line 1
cannot bulk load because file “c\data\tempfile.txt” not opened. operating system error code 3(the system cannot find path specified.).

i tried adding name of computer address hoping work following error:
msg 4861, level 16, state 1, line 1
cannot bulk load because file “\\ltsr397941\c\data\tempfile.txt” not opened. operating system error code 53(the network path not found.).

we using sql server 2008 windows authentication.
sql server resides on remote server have access.

can tell me wrong situation.

thanks
vijaya

can suggest alternative bulk load? i'll thankful.

 

 

another methid bcp command-line utility.  functionality similar identical bulk insert t-sql statement except process runs on client can specify local path.  below untested example.  see http://msdn.microsoft.com/en-us/library/ms162802.aspx.

 

bcp mydatabase.dbo.csvtest in 'c\data\tempfile.txt' -s"myserver" -t -c -t"," -r"\n"

 


dan guzman, sql server mvp, http://weblogs.sqlteam.com/dang/


SQL Server  >  Getting started with SQL Server



Comments

Popular posts from this blog

Conditional formatting a graph vertical axis in SSRS 2012 charts

Register with Power BI failed

SQL server replication error Cannot find the dbo or user defined function........