SQL 2000 restore - terminate connections on target database
Posted on 2007-11-30
I have a process which backs up my live database on server A and then restores on server B overnight. The problem is that sometimes the restore to server B fails as there are still user connections to the database I am restoring over the top of. What I need is some code to kill all the connections to a given database - as I know how to do this in enterprise manager but don't have the SQL.
I would suspect I need to query to pull info from somewhere to get the PID and then run a kill.
Any help appreciated