Take the 2-minute tour ×
Database Administrators Stack Exchange is a question and answer site for database professionals who wish to improve their database skills and learn from others in the community. It's 100% free, no registration required.

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

share|improve this question

migrated from stackoverflow.com Dec 28 '12 at 9:12

This question came from our site for professional and enthusiast programmers.

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 '12 at 7:25
    
you could add the local admin as a service account instead of "Network Service".. –  Rohan Dec 28 '12 at 11:27
add comment

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.

share|improve this answer
add comment

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.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.