What’s In A Datetime Anyway?

Last week we talked about my Oracle migration to SQL Server and the vendor’s use of datetime over datetime2.  Today, I thought I would discuss the differences between the two datatypes.

First of all, datetime2 is recommended by Microsoft as opposed to datetime as it provides a larger data range, a larger default fractional precision as well as the optionally defined user precision level.  Datetime2 is also ANSI and ISO 8601 compliant, whereas datetime is not.  Which would you use?

Example:

Datetime2:  2012-06-25 12:45:10.1234567

Datetime:   2012-06-25 12:45:10.123

Books online reference:  datetime and datetime2.  Enjoy!

Advertisements

About SQLGator

Florida Gator and Microsoft Data Platform MVP, Star Wars fanatic and is there anything else...oh yeah PS4! I am a geek and SQL Server DBA who dabbles with VMWare, there are other technologies greater than these? Not so fast my friend! I also love to travel to new and exotic places.

Posted on June 25, 2012, in Scripting and tagged , . Bookmark the permalink. Leave a comment.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: