Search

Wednesday, June 1, 2011

Attach Database Failed

Error Message
Attach database failed for Server 'SERVERNAME\SQLEXPRESS'. (Microsoft.SqlServer.Express.Smo)

Additional information:
An exception occurred while executing a Transact-SQL statement or batch.
(Microsoft.SqlServer.Express.ConnectionInfo)
Unable to open the physical file "filename.mdf". Operating system error 5: "5(error not found)".(Microsoft SQL Server, Error: 5120)

Solution.
Please make sure that the SQL Server Service account has modify permissions over the physical file on the hard drive that you are trying to attach to a SQL Server instance, and modify permissions also over the folder that contains the file.


1 comment:

  1. If you are facing the error 5120 while attaching the MDF file then SQL recovery tool is the best that repair corrupt SQL database & smoothly attach MDF file in SQL Server without any error. http://www.sqlrecoverysoftware.net/blog/how-to-fix-sql-error-5171.html

    ReplyDelete