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…
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…
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…
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…
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…
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…
In the #sqlhelp Slack channel on the SQL Server Community Slack workspace last month, Jemma Hooper asked: When trying to CAST or CONVERT a datetime2 value to binary(8), I’m getting a “binary or text data…
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…