BULK INSERT Syntax SQL
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 bec开发者_运维技巧ause 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?
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
Its two slashes and no http
BULK INSERT dbo.FNSR FROM '\\yahoodd.velocitytrading.net\txtfiles\FNSR.txt'
WITH ( FIRSTROW = '2', FIELDTERMINATOR = '\t', ROWTERMINATOR = '\n' )
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.
精彩评论