Wednesday, October 24, 2012

How to Kill all Processes for a Specific Database

Usually you would just use the Activity Monitor like shown below...

The mundane repetition of right click each process and selecting
Kill Process becomes annoying after the n_th process. 
...buuuuut if you need to restore your Dev Database with fresh data, you need to kill all of the individual connections/processes before attempting a restore. Well when you are doing development work you can have over 10+ connections and using the Activity Monitor is very annoying to close all of them. Therefore I have come up with the following tSQL query:

 db_name(dbid) as DatabaseName,
 KillStatement = 'KILL ' + CAST(spid AS varchar(10)) + '; '
FROM sys.sysprocesses
WHERE dbid = 15 -- Put your Databases ID here

The idea behind this query is to first find out what you database's ID is, enter the ID in the where clause and generate the KILL statements. Copy and paste the KILL statements and execute all of them at once. You will be warned about killing your own connection though like this:

Msg 6104, Level 16, State 1, Line 1
Cannot use KILL to kill your own process.

No worries though you can just kill that process in the Activity Monitor or just close the query window.


Thursday, September 13, 2012

How to get rid of the black border on HDMI output on your AMD Radeon HD 7850

This post has moved along with the rest of this blog to WordPress please go to this link here:

Changed Blog Background

I changed the background of the blog because I think it is easier on the eyes. I have a problem staring at lines that are too close together like the last background. I apologize if that was hard on the eyes for anyone - this new background should even things out nicely.

I will be writing an article soon about office lighting, backgrounds, color and your eyes. Things people take very lightly, but should be more serious about. A preview of what I am referring to is - stop using white backgrounds especially if you wear glasses with a crappy prescription like mine.

Tuesday, May 8, 2012

Saturday, April 28, 2012

Friday, April 13, 2012

Thursday, April 5, 2012

Thursday, February 2, 2012

Wednesday, January 25, 2012