Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 SQL Server Administration (2000)
 SQL Server manager

Author  Topic 

ergodyne
Starting Member

4 Posts

Posted - 2007-11-29 : 04:38:55
Ok, I hope this is the right forum for this

I have a problem in my SQL Server. When I view the databases with SQL Server Manager (I'm using the enterprise manager) I have a database with no name to it. I can not remove this since it gives a message saying
"Error 21776: [SQL-DMO]The name '' was not found in the Databases collection. If the name is a qualified name, use [] to separate various parts of the name, and try again."

Is there a way to delete this empty database?

RickD
Slow But Sure Yak Herding Master

3608 Posts

Posted - 2007-11-29 : 04:46:58
run:

select * from sysdatabases


then find out if the name consists of just one space/tab etc

select len(name) from sysdatabases where id = <theDatabaseID>


Then delete based on these findings.
Go to Top of Page

ergodyne
Starting Member

4 Posts

Posted - 2007-11-29 : 05:12:22
Ok, I found out that the database name has length 0. However I am not able to delete from the sysdatabases.

The dbid for this is 7 and the sid is 0x01050000000000051500000037CC7F1DACD483BC213B148D1A490000 (which I assume is an error)
I have tried the querys

UPDATE sysdatabases SET name = 'Temp' where dbid = 7 (To get a name for the database and then delete it)

delete from sysdatabases where dbid = 7 (just delete the database)

But none of them seem to work. They both give the message
Server: Msg 259, Level 16, State 2, Line 1
Ad hoc updates to system catalogs are not enabled. The system administrator must reconfigure SQL Server to allow this.

Go to Top of Page

ergodyne
Starting Member

4 Posts

Posted - 2007-11-29 : 05:16:36
Ah ok sorry for the extra post. I googled it and found how to solve it.

I needed to set the following:

Put this at the top of the script

go
exec sp_configure N'allow updates', 1
go
reconfigure with override
go


and this at the bottom and run it again

exec sp_configure N'allow updates', 0
go
reconfigure with override
go
Go to Top of Page
   

- Advertisement -