Azure-Sql-Db

SQL: Implicit vs Explicit Transaction Handling - JDBC Driver I'm looking at you

SQL: Implicit vs Explicit Transaction Handling - JDBC Driver I'm looking at you

In a relational database like SQL Server, transactions are the mechanism used to ensure that entire operations either complete or are rolled back. They are a core part of the Atomicity: i.e., the A in ACID.

Typical example

The obvious example used to be that if you transfer funds from one place to another, that both the debit and the credit need to occur, or neither occurs.

Fair enough and straightforward enough.

2026-11-12

SDU Tools: Update Statistics on SQL Server Tables

SDU Tools: Update Statistics on SQL Server Tables

Having up to date statistics is critical for SQL Server choosing appropriate query plans. Poor statistics can lead to poor query plan outcomes.

Generally, SQL Server manages this well by itself. As a rough rule, most versions auto-update statistics when the number of changes is about twenty percent of a count of the number of rows in the table. (Some recent changes have slightly altered how this works but the ball park is pretty good).

2026-11-10

SQL: Should you use bit columns?

SQL: Should you use bit columns?

I’ve previously discussed why bit columns can be useful in SQL Server Indexes. But an interesting question is whether you should use them at all.

I previously showed an example of a transaction table that had an IsFinalized column. And if it did, then it’s very likely that I’d want to have it indexed. But what I didn’t discuss was whether that bit column made sense in the first place.

2026-11-09

SQL - Fabric: FABCON and SQLCON are coming to Sydney in April 2027 - Discounts now

SQL - Fabric: FABCON and SQLCON are coming to Sydney in April 2027 - Discounts now

It’s awesome that FABCON is coming to Sydney early next year. It’s now one of the best conferences each year globally and has loads of Fabric and SQL goodness. Our friends at Microsoft have provided this info to let you get an early bird discount.

Register today and Save AUD$300 with code: FABSQL-UG

The APAC Microsoft Fabric + SQL Community Conference (6–9 April 2027, ICC Sydney) brings together data, analytics, BI, and AI professionals from across Asia-Pacific. Hear from Microsoft and community experts with practical guidance, real-world patterns, and lessons learned.

2026-11-07

SQL: Does having more indexes always make data modifications slower?

SQL: Does having more indexes always make data modifications slower?

As I’ve pointed out in other posts, Betteridge’s Law of Headlines says you already know that the answer to this is no.

There is a persistent myth among SQL Server users that having more indexes always slows things down, particularly anything that needs to modify data (INSERT, UPDATE, DELETE, MERGE).

However, there are two aspects of this to consider:

The first is that you need to decide how much the modifications actually matter in the overall performance of the system. In an earlier blog post, I noted that when I trace typical transactional systems, I often see reads making up about 99% of page I/O’s. Writes barely even appear. I’m not saying they are irrelevant but you need to focus on what the system is spending most of its time doing.

2026-11-05

SQL: Which SQL Server columns should be nullable part 2: Avoid placeholder values

SQL: Which SQL Server columns should be nullable part 2: Avoid placeholder values

In a previous post , I was discussing why magic values were a problem. They are often added by developers when they are trying to avoid having any NULL data in a database.

While discussing this, I think it’s worth also highlighting the overall dangers of placeholder values. These are values that aren’t magic values but are ones that are intended to be replaced at a later time.

If you use any of these, you need to have a solid process in place to:

2026-11-03

SQL: Avoid using magic values instead of NULL

SQL: Avoid using magic values instead of NULL

A while back, I wrote about the ANSI_NULLS option for tables and after that I had several more questions related to NULL values.

Note that I mentioned NULL values, not values of NULL, and not values equal to NULL. That’s because being NULL is a state that a value is in, not itself a value. That’s why our queries say IS NULL and not = NULL.

Magic values

Now because of that, many developers see values that are NULL as a pain in the neck as they have to be dealt with separately, unlike other values. This can lead to many poor design decisions but I want to start today with the decision to use magic values.

2026-10-25

SDU Tools: Version 28 is now released for download

SDU Tools: Version 28 is now released for download

Version 28 of our free SDU Tools for developers and DBAs is now released and winging their way out to our SDU Insiders.

You can find details on the tools here .

If you haven’t been using SDU Tools yet, I’d suggest downloading them and taking a look. At the very least, it can help when you’re trying to work out how to code something in T-SQL.

This is a huge release of the tools.

2026-10-13

SDU Tools: Seconds to Duration in T-SQL

SDU Tools: Seconds to Duration in T-SQL

There are a few places in T-SQL where instead of a time value, you need to work with a duration.

An example is if I want to sleep for a short period. In T-SQL, we can do that with the WAITFOR statement, used like this:

This command would cause SQL Server to wait for 10 minutes. One of the challenges though, is how do I create this duration string in a programmatic way? For example, how do I create the string ‘00:02:00’ if I’m starting with a value of 120 seconds?

2026-10-11

SQL: Setting local date and time for Azure SQL Database

SQL: Setting local date and time for Azure SQL Database

I have previously posted information about how to get local date and time happening in Azure SQL Database. Many people have been frustrated about the inability to set any date and time to work with, rather than just UTC.

I posted here about calculating it, and here about how to set it for your session.

While the workarounds were helpful, there were many situations where they just weren’t enough. One simple example is where you’re offering a Software as a Service (SaaS) application and want each tenant database to have its own date and time configuration, but many other people just wanted their database to reflect their own local time.

2026-10-09