I talk about why every CTE I write starts with a semi-colon, and why you won't change my mind about it.
Category: Bad Habits & Best Practices
An index of over a decade's worth of posts and videos involving bad habits and best practices in SQL Server.
In the second part of this series, I show two ways to shift expensive computations to write time.
In this tip I confirm that FORMAT is still a dog compared to even very complex expressions using CONCAT_WS, DATENAME, DATEPART, and CONVERT.
I talk about NULLs in SQL Server, the logical issues with avoiding them, and potential performance impacts.
I talk a bit about bit columns: names with negative context, allowing NULLs, and using cryptic BITWISE operators instead of readable, self-documenting expressions.
In this tip, I use specific examples to counter assumptions that data types are always case insensitive.
In this tip, I discuss one way to help avoid infinite loops in common while loop patterns.
In part 4, I show how to include ad hoc DML queries in the analysis.
In part 3, I tie it together and show how to use relational logic to further eliminate false positives.
In part 2, I show how to identify problematic NOLOCK patterns across multiple databases and multiple instances.
I start a new series on identifying and removing problematic NOLOCK hints from update and delete statements.
I explain why you should eliminate the data types text, ntext, and image from your environment.
I use a real-world example showing why you shouldn't use deprecated functionality like SQL Server Profiler.
I talk about one scenario where the system table
sys.sysprocesses almost led us down the wrong path.
There is a very common anti-pattern you should avoid, involving updating a row if it exists and inserting it if it doesn't. See how to avoid race conditions and deadlocks.
Discover some undocumented or unsupported behavior you might not even realize you're relying on.
Originally published in 2009, I updated this in 2019 with an example showing an effect on the plan cache.
I explain four conventions I always follow when writing T-SQL queries.
Get a first-hand look at some of the ways NOLOCK can produce incorrect data.
This tip was refreshed with status updates for some of the critical bugs discovered in MERGE over the years.