简体   繁体   中英

Cannot bulk load because the file could not be opened. Operating System Error Code 5

I'm trying to insert an image into SQL Server using this SQL query

INSERT INTO dbo.Employees(ImageColumn) 
   SELECT BulkColumn 
   FROM OPENROWSET(BULK 'C:\Users\ahmed\Desktop\employee.jpg', Single_Blob) AS img

but I'm getting this message:

Msg 4861, Level 16, State 1, Line 3
Cannot bulk load because the file "C:\\Users\\ahmed\\Desktop\\employee.jpg" could not be opened. Operating system error code 5 (Access is denied.).

对于您正在运行此SQL语句的任何上下文(例如,在SSMS中),请尝试以admin身份打开应用程序

Try logging in to SSMS under the sa account and try that. I have a lot of permissions issues when I'm logged in as myself, even if I'm logged in with admin privileges.

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