C# ASP.NET SQL SERVER

CREATE FILE encountered operating system error 5 Access is denied

I have an MSSQL 2008 R2 installation and was trying to attach a DB from a non-R2 installation using SQL Server Management Studio (SSMS) and I was getting the following error:

CREATE FILE encountered operating system error 5(Access is denied.) while attempting to open or create the physical file 'C:\Program Files\Microsoft SQL Server\MSSQL10_50.MSSQLSERVER\MSSQL\DATA\MyDataBase.mdf'. (Microsoft SQL Server, Error: 5123)

Found plenty of Google results pointing me to suggestions about SQL Server 2000 and 2005 with instructions on how to add user permissions and which user account needed to be added.

Turned out that all I needed to do was to run SSMS as an administrator and the attach worked.

» Similar Posts

  1. Google Chrome Installer Error 1625
  2. ASP.NET MVC Preview 3 to Preview 4
  3. Cannot drop database because it is currently in use

» Trackbacks & Pingbacks

    No trackbacks yet.
Trackback link for this post:
http://guyellisrocks.com/trackback.ashx?id=258

» Comments

  1. Udo avatar

    I have resolved the problem with the following steps:

    1. Set OS permission on the .mdf file to full permission for 'Everyone'.

    2. Attach the database.

    Udo — July 28, 2010 9:01 AM

» Leave a Comment