简体   繁体   中英

Cannot bulk load because the file “\\<UC Path>\\Test.csv” could not be opened. Operating system error code 1240

I am running SQL 2014. I am trying to execute bulk insert with UNC Path and I am receiving the error below. The Script runs fine if I execute bulk insert with Local Path. Security wise, I have granted myself and Sql service account full access to the file on the remote disk.

TSQL:

bulk insert ExclusionList_BP from '\\Test_Server\Test.csv'with (FIELDTERMINATOR =',',rowterminator='\n' ,firstrow=2)

ERROR:

Msg 4861, Level 16, State 1, Procedure Test, Line 33 Cannot bulk load because the file "\\Test_Server\\Test.csv" could not be opened. Operating system error code 1240(The account is not authorized to log in from this station.).

Any idea would be appreciated.

Cheers Shrestha

I know this is pretty old, but if someone else need it, what you need to do is to map the drive in the server, with the following command:

EXEC xp_cmdshell 'net use \\server\shared_folder YourPassword /user:domain\YourUsername /persistent:yes'

To perform this you must have admin permissions over the server, if not, contact your DBA.

Once, you map the network folder, you should be able to read the file.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM