How do you get a DB in single user mode immediately?
Say a restore needs done, but you have users popping in and out and you need exclusive access to do a restore. The alter database command keeps failing because said access can't be obtained. What do you do?
I've never had any users slip in with this command. I think the ROLLBACK IMMEDIATE almost guarantees that you get the single user connection. But I said almost, so there's still a possibility of someone slipping in.
Well, now I think about it, the RESTORE will just fail if someone else manages to slip in, so I can check for that too. But at least it gives me the wherewithall to try to get exclusive use before the RESTORE starts