all groups > sql server misc > august 2004 >
You're in the

sql server misc

group:

How to delete a database without name



Re: How to delete a database without name Jacco Schalkwijk
8/13/2004 11:32:42 AM
sql server misc: Are you sure the database name is empty? It can be a space, for example:
CREATE DATABASE [ ]
GO
DROP DATABASE [ ]

works fine.

You can confirm if the database name is really empty with:
SELECT name, LEN(name)
FROM master.dbo.sysdatabases

The name could be non-space white space though, and in that case you have to
use the ASCII function to find out what it is.


--
Jacco Schalkwijk
SQL Server MVP


[quoted text, click to view]

How to delete a database without name Edgar Walther
8/13/2004 12:01:45 PM
Hi,

In my databases list there is one database with an empty name. I don't know
how it got there, but I want to get rid of it. My whole SQL Server is
messed up now, I cannot even add a table or something like that.

I cannot drop it from Enterprise manager.

I cannot drop it with SQL, because I don't have a database name.

I tried with SQLDMO :

Public Sub DropDb()
Dim ss As New SQLDMO.SQLServer
Dim db As New SQLDMO.Database
Dim i As Integer
ss.Connect , "sa", "sa"
For i = 1 To ss.Databases.Count
Debug.Print ss.Databases(i).Name, i
Next
ss.Databases(1).Remove
End Sub

But that gave me an error: Excepion_Access_Violation

How can I delete this database?

Any help will be greatly appreciated.

Thanks,

Edgar

Re: How to delete a database without name Edgar Walther
8/13/2004 12:36:50 PM
Hi,

Deleting the record from master..sysdatabases fixed the problem.

Thanks for your help.

Edgar


[quoted text, click to view]

Re: How to delete a database without name Hari Prasad
8/13/2004 3:49:48 PM
Hi,

In Query Analyzer query the Sysdatabases table in Master database and see
the contents for the empty database.

select * from master..sysdatabases

Thanks
Hari
MCDBA



[quoted text, click to view]

Re: How to delete a database without name Tibor Karaszi
8/13/2004 5:04:57 PM
If you actually did a DELETE against sysdatabases, you probably have some other stuff referring to this
database. I.e., you might just have an inconsistent master database. Two tables that comes to mind are
sysaltfiles (some DBCC CHECK... command might find that) and the backup history tables in msdb (which are OK
to have rows for non-existing databases in).

--
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://www.solidqualitylearning.com/


[quoted text, click to view]

Re: How to delete a database without name leonidbogdanov NO[at]SPAM decadesoftware.com
8/18/2004 7:53:27 AM
You should be careful using len() function - it returns the number of
characters excluding trailing blanks.

Leonid.

[quoted text, click to view]
AddThis Social Bookmark Button