Tuesday, March 27, 2012

A Database without a name

Hi
By mistake I ran a SQL Script which was not completed successfully. The
script should create a database, and subsequently create tables, views etc.
The bug in the script was quite obvious, but the database was created -
without a name, and without any tables (including system tables). So - in the
server's list of databases, there is a complete empty one - again without a
name.
I cannot delete it. An attempt result in following error:
21776:[SQL-DMO] The name '' was not found in the database collection..
How can I get rid of this empty database?
Anders
How do you know there is are system tables? Have you gotten into the
database?
Can you try changing the name and then deleting it?
What version are you running?
HTH
Kalen Delaney, SQL Server MVP
www.InsideSQLServer.com
http://blog.kalendelaney.com
"Anders Balslev" <AndersBalslev@.discussions.microsoft.com> wrote in message
news:B4F5FB8B-4191-4E2D-8E19-F1FF84ABD636@.microsoft.com...
> Hi
> By mistake I ran a SQL Script which was not completed successfully. The
> script should create a database, and subsequently create tables, views
> etc.
> The bug in the script was quite obvious, but the database was created -
> without a name, and without any tables (including system tables). So - in
> the
> server's list of databases, there is a complete empty one - again without
> a
> name.
> I cannot delete it. An attempt result in following error:
> 21776:[SQL-DMO] The name '' was not found in the database collection..
> How can I get rid of this empty database?
> Anders
|||Just to add to what Tibor said, you can create a database whose name appears
to be empty but not. For instance, you can run the following statement:
create database [ ] -- with a blank inside the brackets
I'd try the following to see what physical files the database is using:
select name, filename from master..sysaltfiles
Linchi
"Anders Balslev" wrote:

> Hi
> By mistake I ran a SQL Script which was not completed successfully. The
> script should create a database, and subsequently create tables, views etc.
> The bug in the script was quite obvious, but the database was created -
> without a name, and without any tables (including system tables). So - in the
> server's list of databases, there is a complete empty one - again without a
> name.
> I cannot delete it. An attempt result in following error:
> 21776:[SQL-DMO] The name '' was not found in the database collection..
> How can I get rid of this empty database?
> Anders
|||Hi Tibor
I did as you told, and one of the rows affected was
**
(no space between the asterix)
b.t.w. I didnt tell that it was SQL Server 2000
I presume that I can't just delete it manually from the
master.dbo.sysdatabases
Anders
"Tibor Karaszi" wrote:

> I suggest you first determine whether the database is truly without name or if the name is a blank
> (space) character or similar. Please remember to post version of SQL Server. I assume 2000 (due to
> the DMO error). Here's what I would start with:
> SELECT '*' + name + '*' FROM master.dbo.sysdatabases
> See if you find your database and whether there is anything inside the asterisks.
> --
> Tibor Karaszi, SQL Server MVP
> http://www.karaszi.com/sqlserver/default.asp
> http://sqlblog.com/blogs/tibor_karaszi
>
> "Anders Balslev" <AndersBalslev@.discussions.microsoft.com> wrote in message
> news:B4F5FB8B-4191-4E2D-8E19-F1FF84ABD636@.microsoft.com...
>
|||Take a look here:
http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=351489&SiteID=1
...I was going to suggest "DROP DATABASE []", but it looks like there are a
few options on this page, one of which was reported to have worked.
"Anders Balslev" <AndersBalslev@.discussions.microsoft.com> wrote in message
news:B4F5FB8B-4191-4E2D-8E19-F1FF84ABD636@.microsoft.com...
> Hi
> By mistake I ran a SQL Script which was not completed successfully. The
> script should create a database, and subsequently create tables, views
> etc.
> The bug in the script was quite obvious, but the database was created -
> without a name, and without any tables (including system tables). So - in
> the
> server's list of databases, there is a complete empty one - again without
> a
> name.
> I cannot delete it. An attempt result in following error:
> 21776:[SQL-DMO] The name '' was not found in the database collection..
> How can I get rid of this empty database?
> Anders
|||No, you can't delete it manually because that won't get rid of all the
associated information, but what you can do in SQL 2000 (but not in 2005) is
to manually update the system table sysdatabases to give it a name, and then
you should be able to get rid of it.
Did you try changing the name as I suggested from the EM tool? What
happened?
HTH
Kalen Delaney, SQL Server MVP
www.InsideSQLServer.com
http://blog.kalendelaney.com
"Anders Balslev" <AndersBalslev@.discussions.microsoft.com> wrote in message
news:C9214C27-9448-41EB-9C39-3ED346EFDDF8@.microsoft.com...[vbcol=seagreen]
> Hi Tibor
> I did as you told, and one of the rows affected was
> **
> (no space between the asterix)
> b.t.w. I didnt tell that it was SQL Server 2000
> I presume that I can't just delete it manually from the
> master.dbo.sysdatabases
> Anders
> "Tibor Karaszi" wrote:

No comments:

Post a Comment