2

I can not get a SQL Bulk Insert Statement to Run via C# on my Web Server or locally. I am trying to import data from a text file into a SQL Web Server.

After I connect to the Web server / SQL Server the The statement I am using is as as follows..

BULK INSERT dbo.FNSR
            FROM 'http:\\yahoodd.velocitytrading.net\txtfiles\FNSR.txt'
            WITH
            ( 
                FIRSTROW = '2',
                FIELDTERMINATOR = '\t', 
                ROWTERMINATOR = '\n'
)

then I get this error.

Cannot bulk load because the file "\yahoodd.velocitytrading.net\txtfiles\FNSR.txt" could not be opened. Operating system error code 53(The network path was not found.).

I have tried this with 'http"://webserver.remotefile.txt' as listed above also... with a slightly different result (error code 123 dir, path not valid )

Any ideas?? I can not upload the txt file to the WebServer as a local txt file... what I am I doing wrong.. how is this supposed to work?

3 Answers 3

1

To specify a shared data file, use its universal naming convention (UNC) name, which takes the general form, \Servername\Sharename\Path\Filename. Additionally, the account used to access the data file must have the permissions that are required for reading the file on the remote disk.

BULK INSERT AdventureWorks2008R2.Sales.SalesOrderDetail
   FROM '\\computer2\salesforce\dailyorders\neworders.txt';
GO

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

Sign up to request clarification or add additional context in comments.

1 Comment

Its the issue of referencing an internet file that I am having issues with...remotely uploading a file from the internet
0

Its two slashes and no http

BULK INSERT dbo.FNSR FROM '\\yahoodd.velocitytrading.net\txtfiles\FNSR.txt' 
WITH ( FIRSTROW = '2', FIELDTERMINATOR = '\t', ROWTERMINATOR = '\n' )

2 Comments

It was due to the virtual path not being found I think... I am going to use an IP address but this does over come the initial error
I totally give up.. I have tried referencing IP address, moving it to parent domain, checking security profiles for having Bulk Insert Rights and it just will not see the file, I don't think this is possible, I am moving on to Bulk Copy using C# and DataTables
0

It has to be a local drive.

The part FROM 'http:\yahoodd.velocitytrading.net\txtfiles\FNSR.txt' should be replaced by C:.......\some.txt.

If it's from http://... you will have to stream through it.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.