Sql-server – SQL server bulk insert fail code 5 [SQLSTATE 42000] (Error 4861)

bulk-insertsql server

Following error occurs on running sql job.

Cannot bulk load because the file could not be opened. Operating system error code 5(Access is denied.). [SQLSTATE 42000] (Error 4861). The step failed.

Looks like permission error. Scenario is that Source File is located on Server-A and SQL Server is installed on Server-B. How can I give access to file. SQL User is not showing on below window.

enter image description here

Best Answer

in-order to access a file in another machine using SQL Server you may give permission to the Account which you have used to start your sql-server instance.

if you have active directory on your environment make sure to start sql-server instance with an active directory user and give required permission to to that user on "Server-A". Change the Service Startup Account for SQL Server

but if you do not have any active directory on your Environment the only way to do this is to have a user with the exact name and password of your sql-server service user on Server-A

enter image description here