Stored Procedure for database clean-up

  • Posted
  • Proposals 2
  • Remote
  • #13137
  • Archived
Peter E.David G. have already sent a proposal.
  • 1

Description

Experience Level: Intermediate
I have an application that reads data from different sources and then posts that data into a \"Readings\" table (Source_ID, Date, Time_slot, Reading). If my application cannot connect to the source it posts an entry with \"-1\" in the Reading field.

I am looking for a Stored Procedure that works through the database, identifies the missed readings, i.e. those with -1 (grouped by Source_ID), identifies the number of consecutive missed readings, then takes the value from the first successful read following the missed readings and equally divides it over all the missed readings including the first successful read and also posts a Y into a new field called \"Averaged\" for the readings that have been updated.

Database is SQL Server 2005. A sample database can be supplied to test against.

Project deliverables to include source code and all intellectual property rights including copyright.

Clarification Board

    There are no clarification messages.