Getting error while bulk insert: Cannot bulk load because the file "WK48.csv" could not be opened. Operating system error code 1346(Either a required impersonation level was not provided, or the the provided impersonation level is invalid.)

Nitin Jena 0 Reputation points
2024-06-16T16:32:40.12+00:00

The issue arises when attempting to execute a BULK INSERT operation in SQL Server, encountering an "Operating system error code 1346" stating the file "C:\Intel\Data\OMS.csv" cannot be opened.

I have given the permissions to the user.

User's image

User's image

SQL Server Other
0 comments No comments
{count} votes

2 answers

Sort by: Most helpful
  1. Erland Sommarskog 121.4K Reputation points MVP Volunteer Moderator
    2024-06-16T17:39:50.63+00:00

    I have never seen that error before, but here is a clue: When you use BULK INSERT and you are logged in with a Windows login, SQL Server will impersonate your login when accessing the file. Thus, it is your permissions that apply, not those of the service account.

    But the error message tells us that it is not the permission on the file that matters, but it is the impersonation as such that fails. Why, and exactly what that message means, I don't know. That's something that happens in Windows.

    A possible workaround is to run the BULK INSERT command being logged in with an SQL login, because in this SQL Server will access the file with credentials of the service account. That is, itself, and there is no impersonation.


  2. LiHongMSFT-4306 31,566 Reputation points
    2024-06-17T07:44:44.7866667+00:00

    Hi @Nitin Jena

    Regarding error code 1346, it is a windows system error that occurs when a program attempts to impersonate another user but does not have the necessary privileges to do so.

    See this article to troubleshoot this issue.

    Best regards,

    Cosmog Hong


    If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.