CHAPTER 10

image

Working with Dates and Times

by Wayne Sheffield

SQL Server has several different date and time data types, with varying levels of range and precision (and a corresponding varying level of storage requirement space). SQL Server also has numerous functions to retrieve, modify, and validate the data from these data types in various formats. This chapter focuses on these functions. Table 10-1 shows the various date/time data types.

Table 10-1. SQL Server Date/Time Data Types

image

10-1. Returning the Current Date and Time

Problem

You need ...

Get SQL Server 2012 T-SQL Recipes: A Problem-Solution Approach 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.