简体   繁体   English

批量插入语法SQL

[英]BULK INSERT Syntax SQL

I can not get a SQL Bulk Insert Statement to Run via C# on my Web Server or locally. 我无法在Web服务器上或本地通过C#运行SQL批量插入语句。 I am trying to import data from a text file into a SQL Web Server. 我正在尝试将数据从文本文件导入SQL Web Server。

After I connect to the Web server / SQL Server the The statement I am using is as as follows.. 连接到Web服务器/ SQL Server之后,我正在使用的语句如下。

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. 无法批量加载,因为无法打开文件“ \\ yahoodd.velocitytrading.net \\ txtfiles \\ FNSR.txt”。 Operating system error code 53(The network path was not found.). 操作系统错误代码53(找不到网络路径。)。

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 ) 我也用上面列出的'http“://webserver.remotefile.txt'尝试了此操作...结果略有不同(错误代码123 dir,路径无效)

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? 我无法将txt文件作为本地txt文件上传到WebServer ...我做错了..这应该如何工作?

To specify a shared data file, use its universal naming convention (UNC) name, which takes the general form, \\Servername\\Sharename\\Path\\Filename. 若要指定共享数据文件,请使用其通用命名约定(UNC)名称,其通用格式为\\ 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 http://msdn.microsoft.com/en-us/library/ms175915.aspx

Its two slashes and no http 它的两个斜杠和没有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 . FROM'http:\\ yahoodd.velocitytrading.net \\ txtfiles \\ FNSR.txt'部分应替换为C:....... \\ some.txt

If it's from http://... you will have to stream through it. 如果来自http:// ... ,则必须通过它进行流式传输。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM