SQL Server: Most optimal way of storing time (without date)

Viewed 11040

Here's one more or less for perfection's sake.

Microsoft SQL Server only contains the field type datetime for storing dates and times.

But let's say that I want to store a list of business hours, where the date is completely irrelevant. Currently I'm using the datetime type and then simply displaying the time-portion of the data. But I have two problems with this.

  1. It seems awkwardly inefficient.
  2. It may confuse future developers to see a full-blown date coming along with the time, which they may not know whether is used anywhere or not.

And so it begs the question; in the absence of a specific time field (like in MySQL), what is the most optimal way of storing only a particular time of day, from 00:00 to 23:59?

UPDATE: It's SQL Server 2005. (Also I'd just be interested in knowing what to do in general when there is no time type.)

5 Answers
Related