Search code examples
sql-serverbulkinsert

SQL Server Bulk Insert Http file


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?


Solution

  • 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.