The easy way to handle UTF-8 in a .NET application when dealing with SQL Server 2019

A short post this week. On a mailing list recently, someone noticed that a .NET application writing to SQL Server did not have the expected behaviour with UTF-8 collation and data types. To refresh our memories, UTF-8 is newly supported in SQL Server 2019, and provides potential savings of up to 50% when storing strings,
-> Continue reading The easy way to handle UTF-8 in a .NET application when dealing with SQL Server 2019

Post image

Dates and Times in SQL Server: What about TIMESTAMP?

It occurred to me that we haven’t covered the TIMESTAMP data type in this series about dates and times. TIMESTAMP is the Windows Millennium Edition of data types. It has nothing to do with date and time. It’s a row version. Microsoft asks that we stop calling it TIMESTAMP and use ROWVERSION instead. Much like DECIMAL
-> Continue reading Dates and Times in SQL Server: What about TIMESTAMP?

Dates and Times in SQL Server: DATETIME2

This post continues our look at date and time data types in SQL Server. SQL Server 2008 introduced new data types to handle dates and times in a more intelligent way than the DATETIME and SMALLDATETIME types that we looked at previously. This week, we look at the DATETIME2 data type. I’m not the first person
-> Continue reading Dates and Times in SQL Server: DATETIME2

watch

Dates and Times in SQL Server: TIME

This post continues our look at date and time data types in SQL Server. SQL Server 2008 introduced new data types to handle dates and times in a more intelligent way than the DATETIME and SMALLDATETIME types that we looked at previously. What is the time? This week, we look at the TIME data type. It
-> Continue reading Dates and Times in SQL Server: TIME

Calendar

Dates and Times in SQL Server: DATE

This post continues our look at date and time data types in SQL Server. SQL Server 2008 introduced new data types to handle dates and times in a more intelligent way than the DATETIME and SMALLDATETIME types that we looked at previously. The first one we look at this week is DATE. Whereas DATETIME uses eight
-> Continue reading Dates and Times in SQL Server: DATE

Post image

Normalization, The Sequel

If there’s one thing that SQL Server is really good at, it’s relationships. After all, a relational database management system without the relationships is nothing more than a place to store your stuff. Last week we briefly looked at a denormalized table, and then I suggested that breaking it up into five separate tables would
-> Continue reading Normalization, The Sequel

Post image

A First Look At Normalization

Phew! There’s a lot to take in with data types, collation, precision, scale, length, and Unicode, and we’re just getting warmed up. This week’s post is over 2,000 words long!

Over the last three weeks, we’ve gone fairly deep into data types, and now we are going to see how they come into play with normalization.

If we go back to the first post in this series, I mentioned normalization, and then apparently I forgot about it in the next two posts. What you didn’t see is that I was talking about it all along.

[…]

Post image

Fundamentals of Data Types

Last week, we discussed storing text in a database. This week we will dive deeper into data types. When storing data in our database, we want to make sure that it’s stored accurately and that we only use the required amount of space. This is because when we access the data later, we want to
-> Continue reading Fundamentals of Data Types

Post image

Data Efficiency in SQL Server: DECIMAL

This is part two of a short series of posts about how I assign efficient data types when designing a new table or database. Use less space with BIGINT Last week, I spoke about a more efficient DATETIME than DATETIME. This week I have a more efficient DECIMAL than DECIMAL. If you’re planning to store
-> Continue reading Data Efficiency in SQL Server: DECIMAL

Post image

Data Efficiency in SQL Server: DATETIME

This is the first in a short series of posts about how I assign efficient data types when designing a new table or database. Use less space with DATETIME2 We all know that the DATETIME column uses 8 bytes of space to store the date and time, to an accuracy of a paltry 3 milliseconds. This
-> Continue reading Data Efficiency in SQL Server: DATETIME