Hi all
I want to detach a SQL Server 2000 database using code in C#.
I know what should I do, all I have to do is to call a stored-procedure named sp_detach_db
But the problem occurs when I want to detach it while it's already in use.
As you might have seen, in SQL Server Enterprise Manager when you want to detach a database, there is a "Clear" button which you can use it to disconnect all connected users to that database, and next detach it.
You can see it from this picture:
http://i12.tinypic.com/4rb0rio.jpg
Or:
http://www.sooti.ir/images/SQLClearButton.JPG
Now, what I want is to simulate pressing the Clear button by programming !
In fact, I want to disconnect any previously connected users to my database. Just like what SQL Server Enterprise Manager does.
Is there any solution?
Thanks All !