T-SQL Tuesday #104: Code I’d Hate To Live Without

It’s T-SQL Tuesday time again, and this month the host is Bert Wagner (b|t) whose topic of choice is “write about code you’ve written that you would hate to live without.” There are so many different scripts I use every day it's difficult to pick just one, but I find myself using the following script frequently. … Continue reading T-SQL Tuesday #104: Code I’d Hate To Live Without

Finding the Least and Greatest value over multiple columns.

I had a situation last week where I needed to find the MIN() and MAX() values of some data. Normally this would be pretty straightforward, but the problem was I needed to identify the MIN() and MAX() values amongst multiple columns. So today I bring you a SQL tip using APPLY. Looking at sys.procedures we … Continue reading Finding the Least and Greatest value over multiple columns.

T-SQL Tuesday #101: Handy Tools

It’s T-SQL Tuesday time again, and this month the host is Jens Vestergaard(t) whose topic of choice is The Essential SQL Server Tools in my stack Luckily for me, I started a Handy Tools blog series this year for the sole purpose of sharing all the amazing tools I use on a daily basis, so I was pleasantly surprised … Continue reading T-SQL Tuesday #101: Handy Tools

Handy Tool – Statistics Parser

The next blog in my series of Handy Tools, I give you statisticsparser.com . Thank you, Richie Rump (t)! This awesome free tool allows you to take the output from statistic io, time and paste it into the web page. It will then parse all that information into a useful and more readable output and aggregate your reads, … Continue reading Handy Tool – Statistics Parser

Table swapping switcheroo (PARTITION SWITCH)

I love finding an obscure, rarely talked about feature in SQL Server, and today that is ALTER TABLE...SWITCH PARTITION I was working with a query that was doing several calculations and would take 10- 15 seconds to complete. It was being executed 20-30 times a minute by different users and was causing problems... BLOCKING...eating up CPU...just … Continue reading Table swapping switcheroo (PARTITION SWITCH)

TSQL Tuesday #93: Interviewing Patterns & Anti-Patterns

It's T-SQL Tuesday time again, and this month the host is Kendra Little (b | t) whose topic of choice is Interviewing Patterns & Anti-Patterns TL:DR Version - Passion and Aptitude. When hiring someone, make sure they're passionate about the job and have the aptitude to learn and grow. My story starts when I was … Continue reading TSQL Tuesday #93: Interviewing Patterns & Anti-Patterns

identifying broken numeric sequences using SQL – Part 1 (Islands)

Sometimes a sequential chain of numbers gets broken, and sometimes you may want to identify where that break in sequence happens. Well if you’re looking for solution, here is the quick and dirty on how to get it done. In this 2 part series we’ll explore how to identify gaps and islands in your data. … Continue reading identifying broken numeric sequences using SQL – Part 1 (Islands)

IMPLICIT CONVERSION

When troubleshooting performance issues in SQL Server,one of the more common mistakes I come across are mismatched datatypes in predicates. This can cause a huge hit in performance and sometimes it won't make a difference at all. Check out my sample code below, and watch out for IMPLICIT_CONVERSION !!! /*Step 1 - Run this to … Continue reading IMPLICIT CONVERSION