Diagram of Batman's utility belt

T-SQL Tuesday #143: My favorite short scripts

October 12, 2021 Andy 2

For this month’s T-SQL Tuesday, John McCormack (blog|twitter) asks us: “What are your go-to short, handy scripts”? I’ve got so many handy dandy scripts, it was hard to choose. Where to start? I have so many go-to scripts that are short, amazing, and I use … [Read More]

What time is it in Oz?

October 5, 2021 Andy 1

There was a recent post on Database Administrators, where there was some confusion over Daylight Saving Time(DST) in Australian timezones. Let’s be honest though–timezones are confusing, especially when DST comes into play. Arizona Time doesn’t observe Daylight Saving Time, so sometimes it’s the same as … [Read More]

Stop using sp_hexadecimal & sp_help_revlogin

July 6, 2021 Andy 2

Since I started at Stack Overflow, I’ve had the chance to see some of the interesting challenges with running our databases at our scale. My coworker Taryn Pratt (blog|twitter) recently blogged about fighting with deadlocks related to Stack Overflow for Teams. Lots of logins Taryn … [Read More]

Blocking with OBJECT_NAME()

December 24, 2019 Andy 0

As a DBA, you probably use the OBJECT_NAME() function quite a bit. I know I do. If you aren’t familiar with it, you can read the documentation if you want, but it’s a pretty straightforward function that converts object IDs into object names. I ran … [Read More]

Code to purge data based on creation date

April 4, 2019 Andy 6

Yesterday, I talked about batching deletes, and the day before I talked about how much I like to delete data, and why it’s necessary to do it, despite being a data pack rat. Today, let’s look at just one scenario, and how I like to handle it. In my experience, this is one of the most common purge requirements (and probably the easiest), so first, let’s look at the business requirements.

TSQL Tuesday #104: dbo.Check_FileSize

July 9, 2018 Andy 2

It’s been a little bit since the last T-SQL Tuesday I joined, when I blogged about religion & politics. This month, I answer Bert Wagner’s call to blog about code I would hate to live without

Parsing file names from paths using T-SQL

January 17, 2018 Andy 15

SQL Server is great at a lot of things. I spend a lot of time blogging about all the cool things that SQL Server does. But (you knew there was a “but”, didn’t you) SQL Server isn’t great at everything. Lets write about something that … [Read More]

Finding active transactions

January 2, 2018 Andy 2

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 sorts of problems–not just blocking, but it can affect your Availability Groups & Mirroring, your TempDB version store … [Read More]

Alerting on SQL Server Blocking

December 18, 2017 Andy 20

Identifying blocking is one of the most basic things that a DBA should be monitoring for. I previously wrote about how to identify blocking in SQL Server and find the leading blocker. Recently, my friend Jim Donahoe (blog | twitter) asked me about setting up … [Read More]