I am trying to attach a database in SQL Server 2008 and I have .mdf file of database but I am getting an exception of
Attach database failed for Server ‘Bilal-PC’. (Microsoft.SqlServer.Smo)
Unable to open the physical file "E:\Intelliscence\Backups\test (2011-07-19)\Database\QBankDB.mdf". Operating system error 5: "5(Access is denied.)". (Microsoft SQL Server, Error: 5120)
I searched the solution of this problem and found one solution of access rights of database file but database file has already full control access rights. Now I want to attach this database or want to get script of this database. But How?
I know this is a duplicate question but all the solutions given in answers are not working for me that’s why I am posting this question.
Please help me.
The error message seems pretty straightforward: Access is denied. You need to make sure the SQL Server service account has adequate permissions on E:\Intelliscence\Backups\QBank (2011-07-19)\Database\, or move the MDF/LDF files for the data/log folders for the instance (where this shouldn’t be a problem).