-
Force Detach
Hi
I need to detach a Database, but with "EXEC sp_detach_db 'test','false'" I can't do this because it is in use.
Is there a Possibility to make a "force detach" or something?
Thanks for Help
Greets
-
kill all the spid that is connecting to your database before executing detach command.
use something like usp_killprocess
refer
http://www.databasejournal.com/featu...le.php/2174031
-
You can use this to kill all sessions in northwind database
exec master..xp_execresultset
'select ''kill '' + cast(spid as char) from sysprocesses where db_name(dbid)=
''northwind''','master'
-
This code will also work:
alter database northwind set single_user with rollback immediate
go
exec sp_detach_db northwind
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
|