What Are Date and Time Data Types in MS SQL Server?
Submitted by: AdministratorDate 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
GO
Submitted by: Administrator
* 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
GO
Submitted by: Administrator
Read Online MS SQL Server Job Interview Questions And Answers
Top MS SQL Server Questions
☺ | How To Start SQL Server Browser Service? |
☺ | How To Execute the Cursor Queries with "OPEN" Statements? |
☺ | How To Test ODBC DSN Connection Settings? |
☺ | PHP MSSQL - How To Display a Past Time in Days, Hours and Minutes? |
☺ | How To Create a Testing Table with Test Data in MS SQL Server? |
Top Databases Programming Categories
☺ | RDBMS Interview Questions. |
☺ | SQL Interview Questions. |
☺ | SSRS Interview Questions. |
☺ | Database Administrator (DBA) Interview Questions. |
☺ | Sybase Interview Questions. |