Friday, August 31, 2007

SQL Server 2008 Date and Time changes

  There are a number of date and time changes coming in the next version of SQL Server 2008 which is currently scheduled for release towards the end of 2007 or early 2008.

 Date and time are now a separate  data types which may make the argument to switch from competing DBMS a little easier. In addition to the new date and time data types, SQL also adds datetimeoffset data type and datetime2 data type.

Here are the highlights of the new data types

Data Type Notes Storage
Date aligns with .Net and SQL Standard data type, supports multiple formats 3 bytes
Time(n) "n" indicates milliseconds precision by default this value is 10 nanoseconds which aligns with windows. 3- 4 bytes
Datetimeoffset(n) Date time offset provides a "time zone aware" data type. date time offset take a parameter that contains the millisecond precision. Time zones from -14:00 to +14:00 are valid  8-10 bytes
datetime2(n) "n" indicates milliseconds precision by default this value is 10 nanoseconds which aligns with windows. 8-10 bytes

 

In addition to adding these new data types SQL Server 2008 also introduces changes in the built in functions, such as GETDATE(), DATEADD() and DATEDIFF() to support these new data types.

The date time changes are welcome additions to SQL server and provide a flexible platform on which to build enterprise applications.

No comments: