• I implemented similar task in PLSQL with functions 'lag' and 'lead' to generate recursively ids between sorted ids current row and next row.

    Could not find them in 2008 MSSQL... So below is the recursive example with left join (with ‘lag and lead’ it could be ‘union’).

    WITH s_Recursive(LEVEL)

    AS

    ( SELECT 0 as level --initial value 0

    union all

    SELECT smr.level+1 as level -- incriment value 1

    FROM s_Recursive as smr Where smr.level< 15 -- max value

    )

    SELECT LEVEL,x.[Workload],x.Units FROM s_Recursive

    left outer join

    (SELECT * FROM (VALUES

    (1, 'EXO',3 )

    ,(7, 'SPO',4 )

    ,(15, 'LYO',10)) AS X (ID,[Workload],Units) ) x

    on s_Recursive.level = x.id