Browse the archive

T-SQL

Finding active transactions

Confessions of a carbaholic: When I start thinking about `ROLLBACK`, I start thinking about rolls. Have you ever forgot to commit a transaction? Maybe you’ve even left for lunch and caused a problem while you were gone. Uncommitted transactions can cause all …

Continue reading

Finding the Leader Blocker

Who's at the front of the line blocking all the traffic? 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 …

Continue reading

Multi-Statement TVFs in Dynamics CRM

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 …

Continue reading

What’s wrong with DELETE EXISTS?

I loved playing Number Munchers on my Apple IIc 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 …

Continue reading

Add-Equals operator

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 …

Continue reading

How to shrink a database in 4 easy steps

I pity the fool who needs to shrink his database! 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% …

Continue reading

CONVERT() to float using scientific notation

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 …

Continue reading

Decoding sql_handle

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 …

Continue reading