Home >> FAQs/Tutorials >> SQL Server FAQ
SQL Server FAQ - DATETIME - Date and Time Data Types
(Continued from previous topic...)
What Are Date and Time Data Types?
Date and time data types are used to store an instances of calendar dates and times.
SQL Server 2005 supports the following date and time data types:
- DATETIME - Date and time values stored in 8 bytes with 4 bytes for the date and 4 bytes for the time.
DATETIME values are in the range of January 1, 1753 to December 31, 9999 with a precision of 3.33 milliseconds.
- SMALLDATETIME - Date and time values stored in 4 bytes with 2 bytes for the date and 2 bytes for the time.
SMALLDATETIME values are in the range of January 1, 1900 to June 6, 2079 with a precision of 1 minute.
Note that SQL Server does not support DATE and TIME data types separately.
Here are some good examples of date and time values:
PRINT '2107-05-19 22:52:51.607'; -- DATETIME
PRINT '2007-05-19 22:52:00'; -- SMALLDATETIME
(Continued on next topic...)
- What Is SQL Language?
- What Is Transact-SQL Language?
- What Is a Transact-SQL Statement?
- How To Start and End Transact-SQL Statements?
- How To Enter Comments in Transact-SQL Statements?
- What Is a Transact-SQL Statement Batch?
- What Happens to a Statement Batch If There Is a Compilation Error?
- How To Use GO Command in "sqlcmd"?
- How To Create User Messages with PRINT Statements?
- How Many Categories of Data Types Used by SQL Server?
- What Are Exact Numeric Data Types?
- What Are Approximate Numeric Data Types?
- What Are Date and Time Data Types?
- What Are Character String Data Types?
- What Are Unicode Character String Data Types?
- What Are Binary String Data Types?
- What Are the Differences between CHAR and NCHAR?
- What Are the Differences between CHAR and VARCHAR?
- What Are the Differences between DECIMAL and FLOAT?