Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Attach database failed for server

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.

like image 371
Billz Avatar asked Jun 05 '12 17:06

Billz


1 Answers

Try to run the Management Studio as Administrator and attach the database.

Right click on Management Studio Properties and Run As Administrator.

Hope it helps you.....

like image 87
ravi2i Avatar answered Sep 18 '22 21:09

ravi2i