This is a slightly enhanced version of the Number Table Function that allows the number sequence to increment in steps. It uses the F_TABLE_NUMBER_RANGE function on the link below, so both are required.Original Number Table Function, F_TABLE_NUMBER_RANGEhttp://www.sqlteam.com/forums/topic.asp?TOPIC_ID=47685if objectproperty(object_id('dbo.F_TABLE_NUMBER_RANGE_STEP'),'IsInlineFunction') = 1 begin drop function dbo.F_TABLE_NUMBER_RANGE_STEP endgocreate function dbo.F_TABLE_NUMBER_RANGE_STEP( @START_NUMBER int, @END_NUMBER int, @STEP int)returns table asreturn(select NUMBER = a.NUMBER*isnull(@STEP,1)from dbo.F_TABLE_NUMBER_RANGE(@START_NUMBER,@END_NUMBER) a)goselect * from dbo.F_TABLE_NUMBER_RANGE_STEP(1,50,20)
Results:NUMBER ----------- 20406080100120140160180200220......9009209409609801000(50 row(s) affected)
CODO ERGO SUM