Cannot bulk load because the file could not be opened. Operating System Error Code 3

后端 未结 7 790
萌比男神i
萌比男神i 2021-02-01 13:38

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

7条回答
  •  说谎
    说谎 (楼主)
    2021-02-01 14:22

    It's probably a permissions issue but you need to make sure to try these steps to troubleshoot:

    • Put the file on a local drive and see if the job works (you don't necessarily need RDP access if you can map a drive letter on your local workstation to a directory on the database server)
    • Put the file on a remote directory that doesn't require username and password (allows Everyone to read) and use the UNC path (\server\directory\file.csv)
    • Configure the SQL job to run as your own username
    • Configure the SQL job to run as sa and add the net use and net use /delete commands before and after

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

提交回复
热议问题