TAGS :Viewed: 7 - Published at: a few seconds ago

[ How to check the data in sql server if it is there for everyminute ]

I have table with

fields: Id, ChId, ChValue, ChLoggingDate

Now the data will be saved for everyminute in to the database. I need a query to check if the data exists for every minute in the table through out the year for a particular weekday. That is, all Monday's in 2013 if it has complete data for that day calculate the arithmetic mean for the year of Monday's.

Answer 1

YOu will need a table - or a table value function - to create a timestamp for every minute, then you can join with that and check where the original table has no data.

Only way - any query otherwise can only work with the data it has.

This is a common approach for any reporting.


explains how, you just must expand it to a times table. If you separate date and time you can get away with a time table (00:00:00 to 24:59:59) and a date table separately.