I am trying to execute this SQL query prior to restoring a .BAK file in SQL Express. Initially, I had the file on the Desktop of my user account. I am logged in as Administrator.
When I try to access the .BAK file on the desktop like this
RESTORE FILELISTONLY FROM DISK= 'C:\Documents and Settings\Administrator\Desktop\file.bak'
I get an error.
Msg 3201, Level 16, State 2, Line 1 Cannot open backup device 'C:\Documents and Settings\Administrator\Desktop\file.bak'. Operating system error 5(Access is denied.). Msg 3013, Level 16, State 1, Line 1 RESTORE FILELIST is terminating abnormally.
However, when I move the .BAK file to C:\temp
, and execute this
RESTORE FILELISTONLY FROM DISK= 'C:\temp\file.bak'
It works just fine.
I cant figure out what is going on. Is there a way to access files on Desktop using Windows Authentication with SQL Express?