Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 Database Design and Application Architecture
 Designing tables for Dates and Time

Author  Topic 

stepcicc
Starting Member

2 Posts

Posted - 2009-04-30 : 06:04:29
Good day

I would like to store data daily on 30min intervals.I have a DateLookup tables that contains a Datekey column as INT and the Date column as DATETIME..example 20090430 , 2009/04/30 12:00:00 AM

I want to capture transactions every 30 min from an inhouse application and store the data in a DataTable along with the time. So I was thinking the Datatable will have the DateKey column to indicate the day but what would the best way be to store the 30 min data. Should I create 3 tables for hours, minutes, and seconds and then use their primary keys along with the DateKey in the DataTable? What would the best way be to work with times as in future I might want to capture data realtime, or every 5 min etc

robvolk
Most Valuable Yak

15732 Posts

Posted - 2009-04-30 : 07:26:03
Ummmm, why not just have a single datetime or smalldatetime column and have it default to GETDATE()? That way you get the exact moment with 1 minute (smalldatetime) or 3 millisecond (datetime) resolution. No need for ancillary tables at all.
Go to Top of Page
   

- Advertisement -