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
need help with vba syntax for microsoft access form
Internet Explorer takes a long time to load, fresh install
Bring in data from linked database in batched
Start up page in VS 2008 using ASP.NET
How to refresh the view in an SDI application
How do i Create a DSN connection in Access??
How to copy section of each field from Colm 1 to Colm 2 in excel
Windows Media player wont play Netflix online movies
Ms Access Query using LAST as criteria to find a record not working and bringing RANDOM Restuls
Are Dell PCs with same OEM number LEGAL ?