Sql Bulk Insert - File does not exist

I have the following query to insert into a table

    BULK
     INSERT tblMain
     FROM 'c:\Type.txt'
     WITH
     (
      FIELDTERMINATOR = ',',
      ROWTERMINATOR = '\n'
     )
    GO

Gets a message

Msg 4860, Level 16, State 1, Line 1
Cannot be in bulk. The file "c: \ Type.txt" does not exist.

The file is clearly there. Anything I can ignore?

+5
source share
3 answers

Look at this: Impossible in bulk. File "c: \ data.txt" does not exist

Is this file located on a SQL Server disk C:\?

SQL BULK INSERT etc. always works only with a local drive on a SQL Server machine. Your SQL Server cannot get to your own local drive.

You need to put the file on the C: \ SQL Server drive and try again.

+21
source

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

> BULK INSERT     [ database_name . [ schema_name ] . | schema_name . ]
> [ table_name | view_name ] 
>       FROM 'data_file' 
>      [ WITH 
>     (

data_file

'data_file'

, . BULK INSERT ( , , ..).

data_file , SQL . data_file - , (UNC). UNC \ SystemName\ShareName\\_. , \ SystemX\DiskZ\Sales\update.txt.

+10

I had this problem before. In addition to checking the file path, you want to make sure that you are referencing the correct file name and file type. Make sure that it is really a text file that you saved in the original location, and not a word file, etc. I am having problems with .doc and .docx. This is my new mistake, but hey, it can happen. The file type was changed and it fixed the problem.

0
source

All Articles