messy paint cans and colours

How SQL Server stores data types: sql_variant

This post looks at a curious data type that isn’t really a data type. Instead, sql_variant tries to be all things to all people. As with most things in life, it has a few shortcomings as a result. If you would like to read about storage of other data types, here are the previous posts
-> Continue reading How SQL Server stores data types: sql_variant

A half-closed MacBook

How SQL Server stores data types: XML

This week we’re looking at how the database engine stores the XML data type in SQL Server and Azure SQL Database. If you would like to read about storage of other data types, here are the previous posts in the series: Bit columns Dates and times Integers and decimals Money Floating points GUIDs What is XML?
-> Continue reading How SQL Server stores data types: XML

A wall of scattered pages from a book

The final word on storage for DATETIME2

Two years ago I wrote a post that got a lot of traction in the comments at the time. Last month there was renewed interest because one of the commenters noted that the official SQL Server documentation for DATETIME2 disagreed with my assertions, and that I was under-representing the storage requirements. To remind you, I
-> Continue reading The final word on storage for DATETIME2

A random selection of tools

How SQL Server stores data types: UNIQUEIDENTIFIER

This week we’re looking at how the database engine stores GUIDs (globally unique identifiers), specifically known as UNIQUEIDENTIFIER in SQL Server. If you would like to read about storage of other data types, here are the previous posts in the series: Bit columns Dates and times Integers and decimals Money Floating points What is a
-> Continue reading How SQL Server stores data types: UNIQUEIDENTIFIER

Black and white Texas Instruments calculator

How SQL Server stores data types: floating points

In this post we are looking at how SQL Server stores floating point values (FLOAT and REAL). If you’d like to read the previous posts in this series of how SQL Server stores data types, you can do so here: Bit columns Dates and times Integers and decimals Money Floating point values If an integer
-> Continue reading How SQL Server stores data types: floating points

Assorted coin lot in clear glass jar

How should I store currency values in SQL Server?

On Twitter, Michael Dyrynda writes: ⚠️ Never ever ever ever ever ever ever ever ever ever ever ever ever ever ever ever ever ever ever ever ever ever ever ever ever ever ever ever ever ever ever ever ever ever ever ever ever ever ever ever ever ever ever ever ever ever store currency as
-> Continue reading How should I store currency values in SQL Server?

A stack of coins

How SQL Server stores data types: money

In this post we look at how SQL Server stores currency values using the MONEY and SMALLMONEY data types. If you’d like to read the previous posts in this series of how SQL Server stores data types, here’s what we’ve got so far: Bit columns Dates and times Integers and decimals 🎶 It’s a rich
-> Continue reading How SQL Server stores data types: money

Blue number notebook

How SQL Server stores data types: integers and decimals

This week we’re going to look at how numbers are stored. This post will cover integers (TINYINT, SMALLINT, INT, BIGINT), and decimals (DECIMAL, which is the same as NUMERIC). If you’d like to read the previous posts in this series of how SQL Server stores data types, here’s what we’ve covered: Bit columns Dates and
-> Continue reading How SQL Server stores data types: integers and decimals

brown and white clocks

How SQL Server stores data types: dates and times

This post dives into how SQL Server stores date and time data types in memory and on disk. But first, a note about endianness: CPUs manufactured by Intel and other vendors process binary values in reverse order (known as little-endian), with the least significant byte in a binary value first, and the most significant (i.e.
-> Continue reading How SQL Server stores data types: dates and times

SQL Server 2019 on Docker no longer runs as root by default

In my home lab I have an Ubuntu virtual machine that runs both SQL Server 2017 and SQL Server 2019 in Docker containers.

After SQL Server 2019 Release Candidate 1 was released, when I performed my usual migration to get the latest version, I noticed that the command line for the SQL Server instance was different.

I used sudo docker ps -a --no-trunc to see the full command, which is emulated below (note: this output is heavily abbreviated).

[…]