I am trying to bulk insert a csv file located on a remote web server but i am getting the following error.
Cannot bulk load because the file "http://34.34.32.34/test.csv" could not be opened. Operating system error code 123(The filename, directory name, or volume label syntax is incorrect.).
Is there anyway to accomplish this?
2条答案
按热度按时间ou6hu8tu1#
The documentation for
BULK INSERT
says nothing about SQL Server being able to connect to web servers.http://msdn.microsoft.com/en-us/library/ms188365.aspx
' data_file ' Is the full path of the data file that contains data to import into the specified table or view. BULK INSERT can import data from a disk (including network, floppy disk, hard disk, and so on).
data_file must specify a valid path from the server on which SQL Server is running. If data_file is a remote file, specify the Universal Naming Convention (UNC) name. A UNC name has the form \Systemname\ShareName\Path\FileName. For example, \SystemX\DiskZ\Sales\update.txt.
If you must import a file from HTTP, consider writing a CLR stored procedure or using SSIS' external connectivity capabilities.
yqkkidmi2#
http://34.34.32.34/test.csv
is, exactly as the error message says, an incorrect file name. Correct filenames look likec:\somefolder\test.csv
. Something that starts withhttp:
is an URL , not a file.BULK INSERT does not support URLs as source. You should download the file first locally (using wget , curl or any other program that can download HTTP content), then bulk insert the downloaded file.