Microsoft
Software
Hardware
Network
Question : How to clear all the connections before restoring a database
hi,
I have a job in sql server 2000, where i created a backup of a database save in a particular location and then restore the backup file to another database in the same server.
But here, if the destination database have any active connection, then the job fails from restoring the database, so what i do is select the destination database, right click and then select detach database and then click on the clear button (connections using this database:).
so please help me how to clear the database connections using a query that i can run in the job before of restoring.
Answer : How to clear all the connections before restoring a database
ALTER DATABASE YourDatabase SET SINGLE_USER WITH ROLLBACK IMMEDIATE
--do you stuff here
ALTER DATABASE YourDatabase SET MULTI_USER
Random Solutions
How to update the database using a datagrid event
sql2000 changing float field to repeating decimal
Unable to connect to SQL Server 05 Express
Save FoxPro Form or Container as jpg or gif
ASP.NET AJAX autocomplete textbox for suggestion
Getting return value from an embedded Internet explorer
I have downloaded the zip of windows 7 for 30 days evaluation version. but now i'm trying to write it to a DVD to make it to boot windows 7 to install in my laptop. i copied the files using nero 8.
Viewing print output from a Stored Procedure in SQL Server Management Studio
Put Two Case conditions in same select statement - SQL Server 2005
Informix ODBC 64 bit drivers for Win 2003 server