T-SQL

Debugging T-SQL Scripts

At some point, every SQL developer or DBA will need to debug T-SQL scripts, either to verify that they behave as expected or to track down the root cause of a problem. Whether you’re building something new or investigating a production issue, debugging is an essential part of the process. There are several techniques available […]

Debugging T-SQL Scripts Read More »

tiger breaking chains

Variables Are Tougher Than You Think

If you’ve been working with T-SQL scripts for a while, you’ve likely encountered variables. These are essential for writing scripts that go beyond basic SELECT, INSERT, UPDATE, or DELETE statements. Variables can serve multiple purposes: they can act as parameters passed into stored procedures, hold the results of one query to use in another, or

Variables Are Tougher Than You Think Read More »

A man using a microscope to examine the page of book

What’s inside a database page?

When starting out with SQL Server, it’s important to focus on learning the basics to avoid getting bogged down with detail but there comes a time when knowing about the internals of a database page can be useful. Lets have a look at how SQL Server groups database pages and what they actually contain. What

What’s inside a database page? Read More »

A calendar on a shelf

Tuning Date Range Queries

SQL Server has been around for many years and does a pretty good job of optimising queries. While there are ways we can help enhance performance, there are also plenty to inadvertently degrade it. A common issue I often encounter occurs in queries across date ranges.

Tuning Date Range Queries Read More »