This post is showing you how to resolve the following error. This error has happened to me when I was trying to Attach a database.
CREATE FILE encountered operating system error 5(Access is denied.) while attempting to open or create the physical file ‘C:\database\xxxxxxStaging.mdf’. (Microsoft SQL Server, Error: 5123)
You go to Windows Folder Access Control List the n you see
But if you go down to the file itself. You see this.
When you click Advanced. Then you see the Owner is gone.
This happened usually because you reinstall your operating system. Give it back an Owner then it will work again.