I have a query that insert data into a table from a data logging system. My issue is that when the system is offline for a prolonged period, I get gaps in the data. The data is an accumulating meter reading, and my query will calculate the datachange between samples and save this in the Datachange column. If gaps are present, the datachange will be huge for the sample DateTime, when the system is back online.
I've attached a sample data file to this question to show my issue. If you look at 11/02/2014 (which is when the system went offline) there are missing samples up to 8/3/2014 and therefore a huge datachange.
What I need to do is run an insert query on this table and insert row data in 15min intervals up until 15mins prior to 8/3/2013 when the system is back online. I also need to populate the 'DataChange' and 'Data' columns. to populate these columns I'd have to calculate the difference between the 'Data' values (So in this example 443023-428475), divide this by the number of inserted rows and use this value as the datachange for each inserted row and accumulate the 'Data' rows by adding this value.