1. Home
  2. Computing & Technology
  3. Databases
photo of Mike Chapple
Mike's Databases Blog

By Mike Chapple, About.com Guide to Databases since 2000

Sorting out SMALLDATETIME, DATETIME and TIMESTAMP in SQL Server

Thursday August 7, 2008
SQL Server 2005 offers three different data types that all sound like likely candidates for storing time values: DATETIME, SMALLDATETIME, and TIMESTAMP. Here's a quick rundown on each:
  • DATETIME is the most common choice for storing date/time values. It's an eight-byte value that stores a date between January 1, 1753 and December 31, 9999 and a time with three millisecond accuracy.
  • SMALLDATETIME is a good choice when space is a concern. It uses only four bytes to store dates between January 1, 1900 and June 6, 2079 along with times to one minute accuracy.
  • TIMESTAMP values do not store timestamps (at least in the clock/calendar sense!) at all. It can be used for row version control, as it stores a value that SQL Server updates each time it modifies a row.
For more on this topic, Robert Sheldon has a great article over on SearchSQLServer.com.
Comments

No comments yet. Leave a Comment

Leave a Comment

Line and paragraph breaks are automatic. Some HTML allowed: <a href="" title="">, <b>, <i>, <strike>

Explore Databases
About.com Special Features

Stay connected and entertained with reviews on tips on the latest HDTVs, cellphones and more. More >

Easy ways to connect two computers for networking purposes. More >

  1. Home
  2. Computing & Technology
  3. Databases

©2009 About.com, a part of The New York Times Company.

All rights reserved.