Aaron Stebner's WebLog

Thoughts about setup and deployment issues, WiX, XNA, the .NET Framework and Visual Studio

How to clean up a SQL 2005 instance name left behind by a previous uninstall

How to clean up a SQL 2005 instance name left behind by a previous uninstall

  • Comments 35

I have heard from a few customers who have tried to uninstall and re-install SQL 2005 and have run into errors with both the uninstall and the re-install.  I have already described the most common uninstall error and a suggested workaround in this previous blog post (an error reading property "Installids" from the cache and/or an error writing property "flagCommit" to the cache).

I wanted to address one of the most common SQL Express install errors I have seen - a duplicate instance name error that causes SQL setup to fail and rollback.  It is pretty easy to tell if you are running into this error if you launch SQL setup directly and step through the SQL setup UI.  However, if you are installing SQL Express as a part of Visual Studio 2005, setup runs in silent mode and you will only see a generic error bubbled up from Visual Studio setup indicating that SQL Express failed to install.

VS 2005 configures SQL Express with an instance name of SQLEXPRESS when it runs SQL setup in silent mode.  If you previously had SQL Express installed and try to uninstall it but something goes wrong with uninstall, you may end up with an orphaned instance name on your system, and then re-installing SQL Express can fail.  In this case, the verbose setup log file for SQL Express will show an error that looks like the following:

MSI (s) (AC!38) [00:01:41:056]: Product: Microsoft SQL Server 2005 Express Edition -- Error 28086. An instance with the same name is already installed on this computer. To proceed with SQL Server Setup, provide a unique instance name.

Error 28086. An instance with the same name is already installed on this computer. To proceed with SQL Server Setup, provide a unique instance name.

If you are running into an error installing SQL Express as a part of Visual Studio 2005 setup, you can check in the SQL Express log files (located at %ProgramFiles%\Microsoft SQL Server\90\Setup Bootstrap\LOG).  If you are receiving an error about the instance name not being unique, you can manually clean off the orphaned instance name by doing the following:

  1. Click on the Start menu, choose Run and type regedit
  2. Go to HKEY_LOCAL_MACHINE\Software\Microsoft\Microsoft SQL Server
  3. Remove SQLEXPRESS from the REG_MULTI_SZ value named InstalledInstances
  4. Delete the subhive named MSSQL.1
  5. Delete the subhive named SQLEXPRESS
  6. Go to HKEY_LOCAL_MACHINE\Software\Microsoft\Microsoft SQL Server\Instance Names\SQL
  7. Delete the value named SQLEXPRESS
  8. Delete the folder %ProgramFiles%\Microsoft SQL Server\MSSQL.1

Note - the above steps apply to the instance name that is created when SQL Express is installed as a part of Visual Studio 2005.  The actual instance name on your system may vary if you have had any other beta version of SQL 2005 (such as the developer edition).  Please make sure to adjust the steps accordingly based on what instance name information is in your registry and file system.

<update date="7/24/2009"> Updated this post to not be beta-specific.  The same type of error can occur if you uninstall and re-install the final release of SQL Express or SQL Express service packs. </update>


  • i have installed the german sql 2000
    sql 2005 named instance (us) and sql express us
    Now i unistalled sql2005 completley to install sql epxress german edition
    i get the above error
    i cleaned the registry and the mssql.1 directory

    any idea?
  • My initial install had gone well with the final vs express release... but later something messed up my installation and i tried to uninstall and reinstall about ten times vs c++ express and sql express server... in different combinations as a whole or only sql server... i tried to follow the instructions on your blog... all went futile.... giving up for now... and hoping that you are planning to address this sql install-uninstall problem in near future ...

    PS. what the heavens is remained behind when i uninstall it??? it is not beta... or is it? under the disguise of final release...
  • Hi Alp - I'm sorry that you've run into this issue. Just to confirm, you have been trying to reinstall the final release of SQL 2005 Express and it is failing? If that is correct, can you please zip and send the log files located at %ProgramFiles%\Microsoft SQL Server\90\Setup Bootstrap\Log\Files to aaronste@microsoft.com so I can try to take a look?
  • Thanks,

    Martin Kulov
  • I need to provide a silent Installation of SQL Express 2005, wherein the user doesn't have to click on the next button as in that of a normal installation by giving the required info and iam using Install Sheild 11.5. Can anyone suggest an idea like how to do a Silent Installation.
  • while I found that Add /remove control panel,there are no list of sql ,but
    start edit we can see that there are
    left item. why ?
  • Hi Lenny - It is possible that the start menu items for SQL were left behind after one of the uninstalls.  The most reliable way to determine whether or not you have any SQL components left on your system is to use the steps listed at http://blogs.msdn.com/astebner/archive/2005/10/30/487096.aspx to see if you have any SQL products installed.  If there are not any SQL components listed in the MsiInv output, then that means the start menu items are just leftover from the previous install but your system does not actually have SQL registered as being installed and you should be safe to install the final release.
  • PingBack from http://hkmicc.wordpress.com/2006/09/15/clean-up-a-sql-2005-instance-name/
  • Where to get Visual Studio 2005 and the .NET Framework 2.0 Where to download the .NET Framework 2.0 redistributable

  • It worked for me, but i was a little desperate and erased de whole sql server key on Local machine. It solved a Business Contact Manager Installation too!

  • Thanks, have spent many hours trying to figure this out

  • worked great! thanks

  • I have the same problem but with SQL 2008. I installed it last year and then uninstalled it the same year. This year im trying to install it again and it says i already have an instance in use.

  • Hi Duarte - I don't have any specific experience working with SQL Server 2008 issues like this, but I think that steps similar to the ones in this blog post will work for SQL Server 2008 as well.  If you don't have any luck with that, then I'd suggest posting a question on the SQL Server setup forum at social.msdn.microsoft.com/.../threads to see if someone there can provide some additional suggestions for you to try.

  • Thanks! Fixed having an old Sophos AV sql instance left in registry!

Page 1 of 3 (35 items) 123
Leave a Comment
  • Please add 8 and 5 and type the answer here:
  • Post