February 14, 2002 at 7:14 am
When I need to restore or detach a database I keep getting the following error :
Project ******* raised exception class EOleException with message '[Microsoft][ODBC SQL Server Driver][SQL Server]Cannot detach the database 'LetITTables' because it is currently in use'. Process stopped. Use Step or Run to continue.
How can I enumerate all connections to the database in question through DMO and kick them out so that I can detach the database?
DAN
February 14, 2002 at 8:07 am
The server object has an enumprocesses method that returns a queryresult. Probably easier to just query sysprocesses directly via ADO then issue kill for anything still connected.
Andy
February 14, 2002 at 8:32 am
quote:
The server object has an enumprocesses method that returns a queryresult. Probably easier to just query sysprocesses directly via ADO then issue kill for anything still connected.Andy
Andy, thanks for the prompt reply. How do I issue the kill command for connections?
February 14, 2002 at 9:20 am
Just use executeimmediate and pass the spid.
Andy
Viewing 4 posts - 1 through 3 (of 3 total)
You must be logged in to reply to this topic. Login to reply