Tuesday, April 29, 2008

New Date and Time Data Types in SQL Server 2008

I am delinquent in the one-a-week challenge post for last week, and on top of that this is going to be a pretty lazy one, as I'm just going to refer to a good article I just found.

My current client has taken to early adopting the latest SQL Server 2008 CTP. One of my favorite new features are the enhanced date and time data types. Dinesh Asanka has a good summary of these new types over at SQL Server Performance and you should really just go check out his article.

My favorite additions are the DATE and TIME data types, how many times have you wanted to just specify a date or time portion of a value and had to do some sort of crazy truncation or logic in code to keep it straight? Well no longer.

Another great addition is the DATETIME2 data type, though its not going to win any awards for clever naming, the gist of it is that you now can specify the millisecond resolution of your DATETIME, previously it was defaulted to 3 decimal places, now you can specify from 0 to 7.

No comments: