Skip to content
A wall of scattered pages from a book

The final word on storage for DATETIME2

  • by

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… 

brown and white clocks

How SQL Server stores data types: dates and times

  • by

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… 

Dates and Times in SQL Server: DATEADD()

  • by

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… 

Dates and Times in SQL Server: AT TIME ZONE

  • by

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… 

Dates and Times in SQL Server: DATENAME()

Last time we looked at DATEPART(). This post is all about the DATENAME() function. So many similarities There are many similarities between DATEPART and DATENAME. Where DATEPART returns the date or time part as an… 

calendar

Dates and Times in SQL Server: DATEPART()

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… 

Dates and Times in SQL Server: DATETIMEOFFSET

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… 

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… 

Be Wary of Date Formatting in T-SQL

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… 

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…