sys.dm_exec_requests

  • Does anyone have code to kill all current database connections prior to a restore (SQL 2005)? Perhaps by utilizing dm_exec_requests?? This was a fairly straightforward bit of coding in 2000 (via sysprocesses table) but is counfounding me in 2005....many thanks!

  • Did you try something like below?

    ALTER DATABASE dbName SET RESTRICTED_USER WITH ROLLBACK IMMEDIATE

  • That did it! Thanks so much.

    Cheers.

Viewing 3 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic. Login to reply