Groups | Blog | Home
all groups > sql server dts > december 2004 >

sql server dts : bulk insert from a remote machine


RJ
12/28/2004 11:19:02 AM
Hi,
I've been trying to get bulk insert to work and have this statement

bulk insert dbo.myTable from 'c:\test.csv'
with (datafiletype='char', FIELDTERMINATOR = ',',ROWTERMINATOR = '\n')

I'm trying to get this to work in the SQL query analyzer. But i see that it
is trying to find this file on the C:\ drive of the box where sqlserver is
running. not on the box where the query analyzer is connecting to sqlserver
from.
As such, i was wondering if there is a way to call bulk insert with the file
not residing on the same machine as the sql server. I tried doing it from the
networked drive and from a \\dir shared directory.
it did not work
how do you call bulk insert and load from a remotely located file?
thanks



Stephen Dybing [MSFT]
12/28/2004 3:21:19 PM
It's the SQL Server that's attempting to perform the bulk insert, not Query
Analyzer on your local box. That would explain the problem you had with your
first attempt. It also likely explains the second. Does the account that is
used to start the SQL Server have permission to access the share?

--
Sincerely,
Stephen Dybing

This posting is provided "AS IS" with no warranties, and confers no rights.
Please reply to the newsgroups only, thanks.
[quoted text, click to view]

Nigel Rivett
1/2/2005 1:11:02 AM
As mentioned - it will be a permission problem.

It's usually easier and faster to copy the file locally and do the bulk
insert from there.
Use master..xp_cmdshell to copy the file.
Use a dir command from xp_cmdshell to check that the server can see the file.

[quoted text, click to view]
AddThis Social Bookmark Button