Range of datetime data type

Posted on : 02-05-2012 | By : Devi Prasad | In : SQL Server Basics, SQLServerPedia Syndication

0



Following is the range of datetime data type:

Lower range(Minimum value) :
‘1752-01-01 00:00:00.000’ January 1st 1752 12 AM

Upper range(Maximum value) :
‘9999-12-31 23:59:59.998’ December 31st 9999 12 PM (milli seconds before next day)

Queries to check the same:
This query executes successfully:
[sql]
SELECT CAST( ‘9999-12-31 23:59:59.998’ AS DATETIME)
[/sql]

This query fails:
[sql]
SELECT CAST( ‘9999-12-31 23:59:59.999’ AS DATETIME)
[/sql]

This query executes successfully:
[sql]
SELECT CAST( ‘1753-01-01 00:00:00.000’ AS DATETIME)
[/sql]

This query fails:
[sql]
SELECT CAST( ‘1752-12-31 23:59:59.999’ AS DATETIME)
[/sql]

Applicable to: SQL Server 2005, SQL Server 2008,SQL Server 2008 r2,SQL Server 2012




Reference : Devi Prasad (sqlserverlearner.com)

Do you like my blog?

If you liked reading this blog, please help spread the word by sharing this blog with your friends.



Need Help On SQL Server?

Cannot Find Solution to your problem (or) If you are looking for some help on SQL Server. Dont worry Click Here to Post your question and solve your issue.




Your Ad Here


Tags: , , , , , , , , , ,