-1

I am in the process of cleaning up a problem I was having with SQL Server 2012 Express. I got locked out of Management Studio, and after many hours of researching, and trying different solutions with no success, I uninstalled SQL Server Management Studio and then re-installed SQL Server 2012 Express again.

I am able to get back into Management Studio. When I go to create my database again, I am given the error message the database exists, and it cannot be created. My database does not show in the Management Studio list of databases.

What do I need to do, so I can create my database again? There is still old data there from the previous install.

marc_s
  • 732,580
  • 175
  • 1,330
  • 1,459
user3169496
  • 23
  • 1
  • 5

3 Answers3

0
USE  master;
GO
DROP DATABASE Database_Name;
GO

OR you can check for Existance of a Database 1st and if Exists then drop

USE master
GO
 IF EXISTS(SELECT * FROM sys.databases 
            WHERE name = 'Database_Name')
    DROP DATABASE Database_Name;
GO
M.Ali
  • 67,945
  • 13
  • 101
  • 127
0

Instead of Creating the same database, try importing the database. Have you looked at

Import Export SQL Server DB's

Community
  • 1
  • 1
Sanket J
  • 187
  • 1
  • 1
  • 12
0

Look in the directories for the previous installation. I'd wager the .mdf and .ldf database files are still there and it's preventing you from creating the database. Alternatively you can try to attach the previous files, however if they were created from a higher level of SQL (such as standard or enterprise) they may not be compatible.

David
  • 1,591
  • 1
  • 10
  • 22