SQL Server rows appear to not be deleting

The Stupid Problem You are working on a database that you are not very familiar with as a developer – meaning that you are not going to think of every little thing that a DBA...

Sql Server tSql: DELETE statement executes but won’t delete

Problem I ran into the most puzzling issue recently where I was executing a DELETE statement inside of a transaction among other statements inside of a stored procedure. Then the weirdest most puzzling thing happened, the statement executed,...

I have no words for how bad this is

I think this should win the “Most Horrible Sproc Parameters” contest if there were such a thing. And then people wonder why I get mad when I see stuff like this. Just wow… Like I...

How to use Excel and tSQL to help you Generate Code

Introduction It’s amazing to me the reactions I get when I show people seemingly simple tricks on how to automate or generate code and/or script generation. Whenever I see a pattern, that means there is...

TSQL: Passing objects to stored procedures via XML

Introduction This is a subject I have heard about repeatedly, but I never bothered looking into it until recently. I was told that writing hard coded insert and update statements is bad practice. To which...

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...