You receive an error when you restore a SQL Server database from a Database Backup file (databasename.bak).
System.Data.SqlClient.SqlError: The operating system returned the error '5(Access is denied.)' while attempting 'RestoreContainer::ValidateTargetForCreation' on 'c:\Program Files\Microsoft SQL Server\MSSQL.1\MSSQL\databasename.mdf'. (Microsoft.SqlServer.Express.Smo)
Note: databasename.mdf is the actual name of your database.
SQL Server is trying to restore the database to '...\MSSQL\databasename.mdf'.'
Change the destination folder to '...\MSSQL\Data\databasename.mdf
Senior Engineer Jessie
Comments