dbTalk Databases Forums  

bulk insert from a remote machine

microsoft.public.sqlserver.dts microsoft.public.sqlserver.dts


Discuss bulk insert from a remote machine in the microsoft.public.sqlserver.dts forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
RJ
 
Posts: n/a

Default bulk insert from a remote machine - 12-28-2004 , 01:19 PM






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





Reply With Quote
  #2  
Old   
Stephen Dybing [MSFT]
 
Posts: n/a

Default Re: bulk insert from a remote machine - 12-28-2004 , 05:21 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.
"RJ" <RJ (AT) discussions (DOT) microsoft.com> wrote

Quote:
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







Reply With Quote
  #3  
Old   
Nigel Rivett
 
Posts: n/a

Default RE: bulk insert from a remote machine - 01-02-2005 , 03:11 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.

"RJ" wrote:

Quote:
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





Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.