SentryOne Team Blog (

Category: T-SQL

Rob Farley : Implementing a Custom Sort

Rob Farley (@rob_farley) discusses some solutions and gotchas for implementing a custom sort using ORDER BY in T-SQL queries.

#BackToBasics : Why I use lower case for data type names (now)

Aaron Bertrand (@AaronBertrand) explains why he codes defensively – matching the case of data type names, even in scenarios where it isn't strictly necessary.

Paul White : The Sort that Spills to Level 15,000

Paul White shows that SQL Server sometimes produces very misleading information about the impact of sort operations.

Pattern Matching : More Fun When I Was a Kid

Aaron Bertrand talks about pattern matching, a childhood game called Simon, and the unpredictability of CHARINDEX vs. LIKE.

Rob Farley : AT TIME ZONE – a new favourite feature in SQL Server 2016

Rob Farley explains why AT TIME ZONE is his new favourite feature in SQL Server 2016, but also shows that it can make a mess of cardinality estimates.

Trust Issues Hurting Database Performance?

Melissa Connors (@MelikaNoKaOi) discusses locating & resolving SQL Server database trust issues (check constraints & foreign keys).


Aaron Bertrand (@AaronBertrand) continues his #EntryLevel challenge with July's entry, a treatment of DATEFROMPARTS() and similar functions introduced in SQL Server 2012.

Slides and Demos from Discovery Day New England

Today I presented at Discovery Day New England, a SQL Server 2016 event (sponsored in part by SQL Sentry) held at the Microsoft office in Cambridge, MA. Attached are demos and slide decks.

#BackToBasics : An Updated

#BackToBasics : An Updated "Kitchen Sink" Example

Continuing the #EntryLevel challenge, Aaron Bertrand (@AaronBertrand) talks about optimizing the "kitchen sink" procedure using dynamic SQL and, optionally, OPTION (RECOMPILE).

Is a RID Lookup faster than a Key Lookup?

For T-SQL Tuesday #78, Aaron Bertrand (@AaronBertrand) takes a look at whether RID Lookups are faster than Key Lookups, with a small battery of fairly simple duration tests.

Slide Decks & Demos from SQLBits

Slide Decks & Demos from SQLBits

Aaron Bertrand (@AaronBertrand) shares his slides and demos from T-SQL and SQL Server 2016 sessions at SQLBits XV in Liverpool, UK.

STRING_SPLIT() in SQL Server 2016 : Follow-Up #2

Aaron Bertrand (@AaronBertrand) shows that, at least for a large number of integer parameters, it is actually OPENJSON() that beats both the new STRING_SPLIT() function and TVPs, and leaves traditional splitting methods in the dust.

Slide Decks & Demos from SQLintersection

Aaron Bertrand (@AaronBertrand) shares his slides and demos from his two SQL Server 2016 sessions at SQLintersection in Orlando this week.

STRING_SPLIT() in SQL Server 2016 : Follow-Up #1

Aaron Bertrand (@AaronBertrand) follows up on a recent post about the performance of STRING_SPLIT() with a few additional reader-motivated tests.

Performance Surprises and Assumptions : DATEADD()

Aaron Bertrand (@AaronBertrand) explores yet another scenario where a date/time function seems to cause the optimizer to behave unexpectedly.