Finding the Leader Blocker

October 26, 2017 Andy 12

During the course of normal processing in a database, blocking happens. Blocking is “by design” because your database is on ACID. In an OLTP database, most of your transactions are short in duration, so we expect blocking to also be short in duration. If blocking … [Read More]

Multi-Statement TVFs in Dynamics CRM

August 22, 2017 Andy 0

If you’re familiar with supporting the database behind Microsoft Dynamics CRM, you probably know that it’s not the fastest-performing database. Honestly, that shouldn’t be a surprise–it’s not designed to be a screaming-fast database. It’s designed to be a flexible database. Most Customer Relationship Management (CRM) systems … [Read More]

What’s wrong with DELETE EXISTS?

June 30, 2017 Andy 1

This morning, when I logged into Twitter, the tweet at the top of my timeline was from Shane O’Neill (blog|twitter). It was to his blog post, Shane, What’s wrong with DELETE EXISTS?.  It’s not that unusual that Shane would talk to himself in the third … [Read More]

Add-Equals operator

May 24, 2016 Andy 9

Shortcuts & tips from an Impatient DBA This series of short posts will demonstrate some lesser-known features, keyboard shortcuts, and other tips that make my day as a DBA more productive. None of these are groundbreaking super-secret features–they are the little things that I do … [Read More]

How to shrink a database in 4 easy steps

April 28, 2016 Andy 9

It’s a really common question: “How do I shrink my database?” Luckily, there’s also a really common answer: “Don’t.” …but what if you really have to? Perhaps you just implemented data compression, and have 60% free space in your database. Perhaps you just deleted a … [Read More]

CONVERT() to float using scientific notation

April 20, 2016 Andy 2

Someone posted to #sqlhelp on Twitter, asking the following: “Wondered if anyone could enlighten me as to why ISNUMERIC(‘7d8’) returns 1?” Sure enough, SELECT ISNUMERIC(‘7d8′) returns a 1. WTF? d isn’t numeric! OK, sure, if you say “seven-dee-eight” out loud it sounds like a number, but “d” is a … [Read More]

No Picture

Decoding sql_handle

February 29, 2016 Andy 0

If you’ve ever looked at sys.sysprocesses or sys.dm_exec_requests (or a number of other DMVs), you’ve noticed there is a column called “sql_handle” that contains some binary gobbledygook. Books Online gives the (un)helpful definition as “Hash map of the SQL text of the request.” sp_WhoIsActive In … [Read More]

No Picture

sp_executesql with output parameters

January 22, 2015 Andy 2

One of my coworkers asked me about output parameters from dynamic SQL today. I pointed him at sp_executesql, which allows for passing parameters into or out of dynamic SQL. The syntax can be confusing at first blush (especially for a new DBA or developer), but … [Read More]