Why is a value in DATETIME2 8 bytes, but in BINARY it is 9 bytes?

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 would be truncated” error. This seems really weird in context with the fact that SELECT DATALENGTH() on a DATETIME2 value[…]

Post image

Assumption Sandwich

Today we went live with a product we’ve been working on for A Long Time, in which a team of five has put in A Lot Of Work. During the walk-through with the customer, loading their initial data onto the production system, we had error after error when trying to insert a particular kind of[…]