• This may be only slightly related, but thought I'd share.

    I used this solution for creating sequential carton labels for shipping.

    I created a procedure that populates a table of sequential numbers by feeding in parameters from a SSRS report. In this case I feed the beginning and ending number.

    CREATE PROCEDURE SEQUENTIAL

    (

    @BEG_NUM INT,

    @END_NUM INT

    )

    AS

    DECLARE @start INT

    DECLARE @end INT

    SELECT @start = @BEG_NUM, @end = @END_NUM

    WHILE @start <= @end

    begin

    INSERT INTO BUR20VM.dbo.SEQUENTIAL_TABLE(CTN_NUM_SEQ)

    VALUES(@start)

    SET @start = @start + 1

    END

    GO

    I then use the resulting table results in a cross join with another table, to get the label output.

    I should also note, when I go to run the next sequence of numbers (for the next shipment), the SSRS report first EXECutes a second stored procedure to delete all values from the previosly created SEQUENTIAL_TABLE, and then re-populates with the new sequence of numbers.

    I think this is a good illustration of a real world application for the sequential table. 🙂