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,
EdgarHi,
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
"Edgar Walther" <EdgarW@.metrixbv.nl> wrote in message
news:411c9232$0$10528$e4fe514c@.news.xs4all.nl...
> 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
>|||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
"Edgar Walther" <EdgarW@.metrixbv.nl> wrote in message
news:411c9232$0$10528$e4fe514c@.news.xs4all.nl...
> 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
>|||Hi,
Deleting the record from master..sysdatabases fixed the problem.
Thanks for your help.
Edgar
"Hari Prasad" <hari_prasad_k@.hotmail.com> wrote in message
news:OiI2E9RgEHA.2984@.tk2msftngp13.phx.gbl...
> 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
>
> "Edgar Walther" <EdgarW@.metrixbv.nl> wrote in message
> news:411c9232$0$10528$e4fe514c@.news.xs4all.nl...
> > 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
> >
> >
>|||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/
"Edgar Walther" <EdgarW@.metrixbv.nl> wrote in message news:411c9a6e$0$49711$e4fe514c@.news.xs4all.nl...
> Hi,
> Deleting the record from master..sysdatabases fixed the problem.
> Thanks for your help.
> Edgar
>
> "Hari Prasad" <hari_prasad_k@.hotmail.com> wrote in message
> news:OiI2E9RgEHA.2984@.tk2msftngp13.phx.gbl...
> > 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
> >
> >
> >
> > "Edgar Walther" <EdgarW@.metrixbv.nl> wrote in message
> > news:411c9232$0$10528$e4fe514c@.news.xs4all.nl...
> > > 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
> > >
> > >
> >
> >
>|||You should be careful using len() function - it returns the number of
characters excluding trailing blanks.
Leonid.
"Jacco Schalkwijk" <jacco.please.reply@.to.newsgroups.mvps.org.invalid> wrote in message news:<OXHCmDSgEHA.3264@.tk2msftngp13.phx.gbl>...
> 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
>
> "Edgar Walther" <EdgarW@.metrixbv.nl> wrote in message
> news:411c9232$0$10528$e4fe514c@.news.xs4all.nl...
> > 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
> >
> >
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment