i was having problem while attaching mdf file in sql server 2008 from my hard disk . When i tried to attach the mdf file i got the following error
Unable to open physical file - Operating system error 5: 5 (Access is denied)
then i just copied that file into defulat directory of sql server 2008 database "C:\Program Files\Microsoft SQL Server\MSSQL10_50.MSSQLSERVER\MSSQL\DATA" and tried to attach and it was attached successfully but I was wondering why its not be able to attach if i do this file from other location then after some googling i have come to know that it was some permission issue and i can attach this from other location too , just need to give rights to user (under which sql server was running) on that folder where my mdf is placed.
then first i check from management studio that-> sql server configuration tool that under which account sql server is running and it was "NETWORK SERVICE" then i just granted full permission to that user on the folder where my mdf was placed and i was able to attach it.