When I try to attach a .mdf file in Management Studio to open it gives me the following error:
An exception occurred while executing a Transact-SQL statement or batch.
(Microsoft.SqlServer.ConnectionInfo)
Unable to open the physical file "C:\DBClass\Sales.mdf".
Operating system error 5: "5(Access is denied.)". (Microsoft SQL Server, Error: 5120)
What is the problem and how do I solve it?
Are you sure it isn’t attached in another instance of SQL Server?
EDIT:
Possible issues are:
Are you sure the MDF file is good? Has it worked on another machine/instance in the past?