Create File encountered operating system error 5(Access is denied.) while attempting to open or create the physical file

Hi all,

Most of time while trying to attach a database in SQL Server We face a issue.

ERROR Message -









TITLE: Microsoft SQL Server Management Studio
------------------------------
Failed to retrieve data for this request. (Microsoft.SqlServer.Management.Sdk.Sfc)
ADDITIONAL INFORMATION:
An exception occurred while executing a Transact-SQL statement or batch. (Microsoft.SqlServer.ConnectionInfo)
------------------------------
CREATE FILE encountered operating system error 5(Access is denied.) while attempting to open or create the physical file 'D:Databasefilepath.mdf'.
(Microsoft SQL Server, Error: 5123)
For help, click:
http://go.microsoft.com/fwlink?ProdName=Microsoft+SQL+Server&ProdVer=10.00.4000&EvtSrc=MSSQLServer&EvtID=5123&LinkId=20476
------------------------------

Resolution -
While starting SQL Server Managment Studio, dont just double click the icon, Right Click it and select Run As Administrator.

Thanks & Regards,
Saurav Dhyani