Range of datetime data type

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

Share:

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:

SELECT CAST( '9999-12-31 23:59:59.998'  AS DATETIME)

This query fails:

SELECT CAST( '9999-12-31 23:59:59.999'  AS DATETIME)

This query executes successfully:

SELECT CAST( '1753-01-01 00:00:00.000' AS DATETIME)

This query fails:

SELECT CAST( '1752-12-31 23:59:59.999' AS DATETIME)

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

(Visited 1,679 times, 1 visits today)



References : Devi Prasad (sqlserverlearner.com)

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.


Do you like my blog?

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




Write a comment



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