Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
Author |
Topic |
NortherLights
Starting Member
2 Posts |
Posted - 2014-11-02 : 23:13:30
|
I have some database backup files sitting in a UNC directory. When I need to delete these files based on user action I create a backup device and then use the sp_dropdevice with the delfile parameter to delete the backup file. I am using dynamic SQL for the device name and the stored procedure was created with the "with execute as" so I can have a proxy account with the diskadmin role on it. This works fine and deletes the file when I run it from the Query window in SSMS.However, when I call that same stored procedure while logged in as the same user from my external application the delfile portion of things isn't working. It is still creating and deleting the backup device, but its not removing the file name. Does anyone have any idea why this would work fine when called through SSMS, but fail to delete the file, but do everything else, when called through my external application using the same AD user?Thanks so much for any ideas. |
|
NortherLights
Starting Member
2 Posts |
Posted - 2014-11-02 : 23:27:23
|
I did one further test that I think might be enough for someone to give me a proper answer.If the filepath uses a lettered drive on the SQL server (c:\share\backup.bak) it works through my external application, but if I use a UNC path to exactly the same location on the SQL Server (\\SQLPC\share\backup.bak) it fails, but only when called through my external application. My SQL Server is running under the "Netowkr Service" account and that account has permissions on the share. |
|
|
|
|
|