Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 Using Bulk Insert- Error- file cannot be opened

Author  Topic 

aahmed99
Starting Member

1 Post

Posted - 2013-01-30 : 16:52:59
I am trying upload a CSV file into SQL Server using the following query:

BULK INSERT intrf_payer_mstr
FROM 'C:\Users\ihsuser\Desktop\edmondson.csv'
WITH (FIELDTERMINATOR=',',rowterminator='\n')

When I attempt to execute, I keep getting an error saying that my query cannot bulk load because the file "C:\Users\ihsuser\Desktop\edmondson.csv" could not be opened. Operating system error code 5 (Access is denied).

Has anyone encountered this problem before, or does anyone know how I can correct this issue? The file is a simple text file and has no blocks or passwords on it.

Any assistance with this would be much appreciated.

robvolk
Most Valuable Yak

15732 Posts

Posted - 2013-01-30 : 17:03:49
C:\Users\ihsuser\Desktop\edmondson.csv refers to your desktop machine, not the SQL Server's disks. Copy the file to a local drive on the server, or better yet to a file share. Use a UNC path rather than local, e.g. \\computer\path\filename.csv
Go to Top of Page
   

- Advertisement -