The same, but using recursive CTE:
DECLARE @i INT DECLARE @n INT SET @i = 100 SET @n = 3000 ;WITH t(c) AS ( SELECT @i UNION ALL SELECT c + 1 FROM t WHERE c < @n ) INSERT INTO Categories(categoryID) SELECT c FROM t OPTION(MAXRECURSION 3000)
source share