24. January 2016
I had this error when trying to attach a SQL database. You may also get "error 1813""Failed to retrieve data for this request. (Microsoft.SqlServer.Managment.Sdk.Sfc)
-> An Exception occured while a Transact-SQL statment or batch.
-> CREATE FILE encountered operating system error 5(Access is denied.) while attempting to open or create the physical file C:\Databasename.mdf. (Microsoft SQL Server, Error: 5123)
This error is a permissions error.
1. Ensure the database has the SQL service account in its ACL. This user is called MSSQLSERVER by default. You can place the database in the below folder and it will inherit the permission
C:\Program Files\Microsoft SQL Server\MSSQL11.MSSQLSERVER\MSSQL\DATA
2. Ensure you run the SQL Managment Studio as Administrator.