I have a requirement to insert a continuous stream of data in a sql table. There is a data feed with the main columns of concern here being the StartTStamp column and the Duration column. The requirement is that if there are any gaps then these should be filled with placeholders. This would be very easy with a cursor but I don't want to use that route. I have come up with a nested query solution but now need to add another requirement - if a gap is filled then there is a maximum duration for each gap fill. i.e if the gap is 1100 and the max duration is 600 then 2 gap rows should be created one with a duration of 600 and one with 500. A gap can be tested for by checking if StartTStamp + duration <> NextStartTStamp. NB there is no identity column in this table. I have come up with the following so far - doesn't handle the max gap size though!! And I think there must be a way to make it simpler. select gaps.StartTStamp, faults_datafeed.StartTStamp - gaps.StartTStamp duration from ( select StartTStamp + duration as StartTStamp from faults_datafeed where StartTStamp not in ( select a.StartTStamp as NextTStamp from faults_datafeed a inner join faults_datafeed b on a.StartTStamp + a.duration = b.StartTStamp ) ) gaps inner join faults_datafeed on faults_datafeed.StartTStamp = (select min (StartTStamp) from faults_datafeed where StartTStamp > gaps.StartTStamp) union select StartTStamp, Duration from faults_datafeed Source Data StrtTS Duration 2800100 290010 4000100 Result using above StrtTS Duration 2800100 290010 29101090 4000100 Is it even possible to max that duration and have 2 rows for it? ie. 2910:600, 3510:490 Dave.