all groups > sql server msde > february 2007 >
You're in the

sql server msde

group:

Error on deleting SQL/MSDE database


Error on deleting SQL/MSDE database Usman
2/6/2007 6:08:33 AM
sql server msde:
Hi,

On calling the source attached below to drop sql database, I get the
following error randomly,

"Cannot detach the database 'DBNAME' because it is currently in use.
[Microsoft OLE DB Provider for SQL Server]"

I am not sure what am I doing wrong here.

Any pointers in this regard will be appreciated.

Regards,
Usman


con.Execute "use master"
' Get list of processes blocking this catalog and try to
kill all them
Set rs = con.Execute("sp_who2", , adCmdStoredProc)
----------------------------------------
If Err.Number = 0 And Not rs Is Nothing Then
While Not rs.EOF
If StrComp(rs("dbname"), sCatalog, vbTextCompare)
= 0 Then
con.Execute "kill " & rs("spid")
' Ignore errors
Err.Clear
End If
rs.MoveNext
Wend
rs.Close
End If

con.Execute "sp_detach_db('" & sCatalog & "', 'true')", ,
adCmdStoredProc ''''''''$$$$$$$$$$$$$$$
Re: Error on deleting SQL/MSDE database Hari Prasad
2/6/2007 10:54:02 PM
Hello,

Do the below command from ISQL window

USE MASTER
GO
ALTER DATABASE <DBNAME> Set SINGLE_USER with Rollback Immediate
GO
DROP Database <dbname>

Thanks
Hari

[quoted text, click to view]

AddThis Social Bookmark Button