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…
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…
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…
We are now in the home stretch of the long-running series about dates and times in SQL Server and Azure SQL Database. This week we look at one of my favourite T-SQL functions when it…
Continuing the series on dates and times in SQL Server and Azure SQL Database, this week we look at the hint AT TIME ZONE. In Azure SQL Database, the regional settings of the database are…
In my previous posts in this series we’ve seen reference to Transact-SQL (T-SQL) functions that are used to get the specific part of a date and/or time (year, month, day, hour, minute, second, etc.). This…
Recently I wrote a post about date and time functions you should never use, which contained an opinion I’ve expressed previously that some people have disagreed with, namely that DATETIME is a terrible data type which…
Previously we looked at four built-in functions to get the current date and time in SQL Server and Azure SQL Database using Transact-SQL (T-SQL). We identified that out of the options provided, SYSUTCDATETIME() is the…
We have come on quite a journey so far. SQL Server and Azure SQL Database provide date and time data types to help you design the best possible database. You can read more about that…
Last week I spoke about a world wary data type for storing dates and times in a single column, with a granularity of three milliseconds, DATETIME. But let’s say you don’t need that kind of…
Last year I ran a series of posts about Database Fundamentals. Over the next few weeks, I will cover the basics of various date and time data types in SQL Server, when to use them,…
Today’s public service announcement is a reminder to be wary of date formatting in SQL Server. On a recent mailing list discussion, one person demonstrated the following code (which I’ve adapted for this post): SET…
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…