I have a routine when updating the backend on a client database:
1) I make the necessary changes to the database on my client's SQL Server.
2) I backup my client's database.
3) I transfer the BAK file to my development server.
4) On my development server, I kill all processes associated with the database. (Image 1.) This takes a while.
5) I run a little script on my server to restore the database using the BAK file and set the recovery model to simple.
It would be cool if I could add a little code to my script that kills all processes associated the target database. This way, step 4 goes away. Does someone know the TSQL or can they point me to a useful link?