Dates and Times in SQL Server: more functions you should never use

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 recommended method because it relies on Coordinated Universal Time (UTC), and uses the DATETIME2 data type which has a much higher[…]

A big thank you

Thank you! Thank you for reading my blog. Thank you for buying my book. Thank you for attending my sessions at SQLSaturdays and SQLBits. Thank you for providing session feedback to help me improve. Thank you for commenting on my posts, especially when I get things wrong. Thank you to the other SQL Server community[…]

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[…]

watch

Dates and Times in SQL Server: T-SQL functions to get the current date and time

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 here: Dates and Times in SQL Server: DATETIME Dates and Times in SQL Server: SMALLDATETIME Dates and Times in SQL[…]

Dates and Times in SQL Server: the science of time redux

Last time, we began an in-depth look at how time is measured. This post continues our journey. If any of you are students of Albert Einstein and his theory of relativity, this might seem familiar. How does a computer know what time it is? Inside the guts of every computer is a clock (called a[…]

Dates and Times in SQL Server: the science of time

Now that we have covered the various date and time data types (see the post from last time) in SQL Server and Azure SQL Database, it’s time to review what we know about time itself and how it is measured, so that we have a basic understanding of how and when to use these data[…]

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 types that we looked at previously. This week, we look at the last new data type, DATETIMEOFFSET. If you’d like[…]

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[…]