Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
Clages1
Yak Posting Veteran
69 Posts |
Posted - 2007-04-28 : 18:45:41
|
| HiI know if I use EXEC sp_detach_db 'pubs', 'true'The database will detached but only if there are no users logged in the database.How can i Logged out (drop out) all the Usesso i can Detach database?TksCLages |
|
|
spirit1
Cybernetic Yak Master
11752 Posts |
Posted - 2007-04-28 : 19:15:33
|
| ALTER DATABASE DatabaseNameSET SINGLE_USERWITH ROLLBACK IMMEDIATE;_______________________________________________Causing trouble since 1980blog: http://weblogs.sqlteam.com/mladenp |
 |
|
|
Clages1
Yak Posting Veteran
69 Posts |
Posted - 2007-05-01 : 10:35:48
|
| HiI still get the same messageCannot detach the database 'teste' because it is currently in use.I saw in BOL , Single user Bring the database to one Userand Detach to work fine needs NOUSERStksC. Lages |
 |
|
|
rmiao
Master Smack Fu Yak Hacker
7266 Posts |
Posted - 2007-05-01 : 13:43:39
|
| Don't run 'ALTER DATABASE' under the db you need to detach. Also ensure apps use that db don't reconnect to it automatically. |
 |
|
|
dinakar
Master Smack Fu Yak Hacker
2507 Posts |
Posted - 2007-05-01 : 13:47:23
|
| right click on the db -> All tasks -> Detach db. It will tell you if there are any connections. You can kill them from the same window.Dinakar NethiSQL Server MVP************************Life is short. Enjoy it.************************http://weblogs.sqlteam.com/dinakar/ |
 |
|
|
Clages1
Yak Posting Veteran
69 Posts |
Posted - 2007-05-02 : 11:05:45
|
| Tkswith RMIAO sugestion works finetksClages |
 |
|
|
|
|
|