• Since you're in SQL Server 2000, we can't use any CTE for this. That said - you should be able to use a temp table to get the ordering down.

    You will also need a tally table to help with filling in the gaps (see Jeff's article on how to set one up[/url])

    The script would look something like the following:

    declare @maxdt datetime

    select @maxdt=MAX(dateval) from table1

    create table #orderedGaps (seq int identity(1,1), dateval datetime, valone int, val2 int)

    insert into #orderedGaps (dateval, valone,valtwo)

    select date, A, B from table1

    order by date

    select o1.seq ,dateadd(day,rn-1,o1.dateval) ajustedDateVal,o2.dateval, o1.valone, o1.valtwo

    from #orderedgaps o1 left join orderedGaps #o2 on o1.seq+1=o2.seq

    join tally on tally.N<= DATEDIFF(day,o1.dateval,isnull(o2.dateval, @maxdt))

    order by date

    ----------------------------------------------------------------------------------
    Your lack of planning does not constitute an emergency on my part...unless you're my manager...or a director and above...or a really loud-spoken end-user..All right - what was my emergency again?