I\'m trying to set up a Stored Procedure as a SQL Server Agent Job and it\'s giving me the following error,
Cannot bulk load because the file \"P:\\file.csv\" could no
I dont know if you solved this issue, but i had same issue, if the instance is local you must check the permission to access the file, but if you are accessing from your computer to a server (remote access) you have to specify the path in the server, so that means to include the file in a server directory, that solved my case
example:
BULK INSERT Table
FROM 'C:\bulk\usuarios_prueba.csv' -- This is server path not local
WITH
(
FIELDTERMINATOR =',',
ROWTERMINATOR ='\n'
);
I would suggest the P: drive is not mapped for the account that sql server has started as.
I did try giving access to the folders but that did not help. My solution was to make the below highlighted options in red selected for the logged in user
To keep this simple, I just changed the directory from which I was importing the data to a local folder on the server.
I had the file located on a shared folder, I just copied my files to "c:\TEMP\Reports" on my server (updated the query to BULK INSERT from the new folder). The Agent task completed successfully :)
Finally after a long time I'm able to BULK Insert automatically via agent job.
Best regards.
It's probably a permissions issue but you need to make sure to try these steps to troubleshoot:
sa
and add the net use
and net use /delete
commands before and afterRemember to undo any changes (especially running as sa
). If nothing else works, you can try to change the bulk load into a scheduled task, running on the database server or another server that has bcp installed.
I have solved this issue,
login to server computer where SQL Server is installed get you csv file on server computer and execute your query it will insert the records.
If you will give datatype compatibility issue change the datatype for that column