Geeks With Blogs
Vishal Shukla

Yesterday I was trying to create my first database on SQL 2008 and thought let me check out if there are any new data types that I can take advantage of and yes in fact there are. The best I liked is Date and Time data type, how many times we needed a field just to store either the date part or just the time part and we ended up using DateTime data type which stores both date and time when you don't need both. Besides saving space in storage it saves the hurdle of reformatting or massaging the code while displaying, comparing or manipulating. I use Oracle more often then SQL sever (not by my choice) and each time we have to compare the date part we have to remember to do the TRUNC to remove the time part, same applies while displaying the fields on screen. Some time we just want to store the time part like Shift start and end time, we still end up storing both date and time and then remove date before displaying. It's just annoying. Also on storage side the date field just takes up 3 bytes instead of 8, one may say that in current time when we are dealing with Tera bytes of data how much does 5 bytes matter; I would say there is no alternative to responsive design.

When I designed my tables first time I added the fields with SQL 2005 in mind, good that I checked the new types and even though I had to redesign some of my tables I think it's worth the efforts :)

Check out TechNet for nice article explaining the types in detail.

That's the fun being in IT field you can never say you know the it, every time you cross check you will learn something new. Happy learning.

Posted on Wednesday, July 1, 2009 12:15 PM | Back to top


Comments on this post: SQL Server 2008 New Data types

No comments posted yet.
Your comment:
 (will show your gravatar)


Copyright © Vishal | Powered by: GeeksWithBlogs.net