We are trying to run Bulk insert in SSMS by logging local SQL Server accounts, But we are getting below error while running the query.
Error:
Msg 4861, Level 16, State 1
Line 1 Cannot bulk load because the file "\\AppserverIpAddress\SharedPath\Insert.TXT"could not be opened. Operating system error code 1326 (the user name or password is incorrect.).
Query:
BULK INSERT TABLENAME
FROM '\\AppserverIpAddress\SharedPath\Insert.TXT'
WITH
(
FIELDTERMINATOR = '|',
ROWTERMINATOR = '\n'
);
Observations:
- The query is running successfully if I am logged in SSMS with Windows authentication (local Windows server administrator account and it has sysadmin privilege)
- Query is throwing error when logged in with SQL Server user account such as
SA
(default sysadmin account) or other SQL Server account. - SQL Server Service is running under local Windows server administrator account (
.\administrator
) - Shared folder resides on the application server and has full control for account "Everyone".
Can anyone suggest a possible reason for this behavior?
That's the documnted behavior:
BULK INSERT
That's a bad idea, and you should change that anyway. Switch to a domain account that has access to the share, or switch back to the default virtual account and grant share access to the machine account eg MyDomain\MyServer$.