New date and time Data Types and Functions

SQL Server 2008 introduces four new date and time data types:


time (precision)

datetime2 (precision)

datetimeoffset (precision)

Two of the most welcome of these new types are the new date and time data types. These new data types allow you to store date-only and time-only values. In previous versions of SQL Server, the datetime and smalldatetime data types were the only available types for storing date or time values, and they always store both the date and time. This made date-only or time-only comparisons tricky at times because you always had to account for the other component (for more detailed examples on working with datetime values in SQL Server, see Chapter 43). In addition, the ...

Get Microsoft® SQL Server 2008 R2 Unleashed now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.