Purushottam
Purushottam

Reputation: 33

How to bulk insert into SQL Server from Excel by query

BULK INSERT dbo.bulkins 
FROM "C:\BulkDataFile.csv" 
WITH 
    (FIELDTERMINATOR =',',
     ROWTERMINATOR = '\n')

Error:

Msg 4860, Level 16, State 1, Line 2
Cannot bulk load. The file "C:\BulkDataFile.csv" does not exist.

How to fix it?

Upvotes: 1

Views: 2622

Answers (1)

marc_s
marc_s

Reputation: 754438

The error message seems crystal clear: "the file ... does not exist" ...

So it seems that this file you're trying to use to do your BULK INSERT just isn't there.

How to fix it? Simple: just put the file where you expect it to be, and run your code again.

And if this is a remote SQL Server, the file must be on the remote machine's C:\ drive - not your local PC's C:\ drive ...

Upvotes: 3

Related Questions