I am try to run bulk insert command on SQL Server 2008 but I am having issues with the security. after researching via internet, the problem has something to do with account delegation and impersonation.

However all solutions seems to point to an Active Directory setup which my setup is not.

My setup is SQL Server 2008 Express on Windows Server 2008 Standard configured as a workgroup.

Despite a SQL Server user account, assigned all the user mappings and server roles and ensuring security set to SQL, I am getting this error:

Msg 4861, Level 16, State 1, Line 1
Cannot bulk load because the file "\server_name\file_name.txt" could not be opened. Operating system error code 5 (Access is denied.).

So, how does one setup SQL Server account delegation and impersonation on a workgroup environment?

Thanks in advance

  • 1
    Can you show us your code? How are you trying to load this file? Does the machine where SQL Server 2008 lives have access to that UNC path?? The Access denied error typically happens if you (or more precisely: the account running SQL Server) doesn't have access to that path
    – marc_s
    Dec 28, 2012 at 7:25
  • you could add the local admin as a service account instead of "Network Service".. Dec 28, 2012 at 11:27

2 Answers 2


Based on the information you provided in the SQL script, the NT account which the SQL Server service is running under doesn't have access to the folder which the file is sitting in. You'll need to see which account the SQL Service is running under, then grant that account rights to the folder.


the error means that your os denied access to the file, you can try running your code after running ssms as administrator, or you can login to ssms using win authentication with the computers admin user.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.