Note that there are some explanatory texts on larger screens.

plurals
  1. POSQL Server Express unable to attach or delete mdf file
    primarykey
    data
    text
    <p>My database file <code>Whist.mdf</code> was attached to a SQL Server Express through Management Studio, but it stopped working in that sense that NHibernate in my asp.net solution fired some connection exceptions. I just detached it from Management Studio because I couldn't open the database in there either.</p> <p>But when I try to reattach it I get this error: </p> <blockquote> <p>Attach database failed for Server 'MyPCName\SQLECPRESS'. (Microsoft.SqlServer.Smo) Unable to open the physical file "C:\Program Files\Microsoft SQL Server\MSSQL10.SQLEXPRESS\MSSQL\DATA\Whist.mdf". Operating system error 32: "32(process cannot access the file because it is being used by another process)". (Microsoft SQL Server, Error: 5120)</p> </blockquote> <p>I have googled it but can't find a solution that works for me. E.g.:</p> <ul> <li><a href="http://www.byteblocks.com/post/2010/01/06/Unable-to-open-the-physical-file-Microsoft-SQL-Server.aspx" rel="nofollow noreferrer">http://www.byteblocks.com/post/2010/01/06/Unable-to-open-the-physical-file-Microsoft-SQL-Server.aspx</a></li> <li><a href="https://stackoverflow.com/questions/8528768/cannot-open-user-default-database-login-failed-after-installing-sql-server-m">&quot;Cannot open user default database. Login failed.&quot; after installing SQL Server Management Studio Express</a></li> </ul> <p>There is something about User Instance but I cant figure out if it have anything to do with that:</p> <ul> <li><a href="http://blogs.msdn.com/b/sqlexpress/archive/2006/11/22/connecting-to-sql-express-user-instances-in-management-studio.aspx" rel="nofollow noreferrer">http://blogs.msdn.com/b/sqlexpress/archive/2006/11/22/connecting-to-sql-express-user-instances-in-management-studio.aspx</a></li> </ul> <p>I have tried to delete the mdf file in windows but I can't do that either:</p> <blockquote> <p>The action can't be completed because the file is open in system</p> </blockquote> <p>I have tried stopping the SQL Server process, closing explore and delete from cmd and rebooting...</p> <p>Hope someone can help - I guess it is just a simple thing..</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload