By using db<>fiddle, you agree to license everything you submit by Creative Commons CC0.
DECLARE @tbl TABLE (
col1 NVARCHAR(2),
col2 NVARCHAR(2),
col3 NVARCHAR(2),
ProjectID INT
)
DECLARE @inc1 INT = 1, @inc2 INT = 1, @ProjectID INT = 50
WHILE @inc1 <= 5
BEGIN
WHILE @inc2 <= 10
BEGIN
INSERT INTO @tbl
VALUES ('a','b', 'c', @ProjectID)
SET @inc2 = @inc2 + 1
END
SET @inc1 = @inc1 + 1
SET @inc2 = 1
SET @ProjectID = @ProjectID + 1
END
SELECT * FROM @tbl
col1 | col2 | col3 | ProjectID |
---|---|---|---|
a | b | c | 50 |
a | b | c | 50 |
a | b | c | 50 |
a | b | c | 50 |
a | b | c | 50 |
a | b | c | 50 |
a | b | c | 50 |
a | b | c | 50 |
a | b | c | 50 |
a | b | c | 50 |
a | b | c | 51 |
a | b | c | 51 |
a | b | c | 51 |
a | b | c | 51 |
a | b | c | 51 |
a | b | c | 51 |
a | b | c | 51 |
a | b | c | 51 |
a | b | c | 51 |
a | b | c | 51 |
a | b | c | 52 |
a | b | c | 52 |
a | b | c | 52 |
a | b | c | 52 |
a | b | c | 52 |
a | b | c | 52 |
a | b | c | 52 |
a | b | c | 52 |
a | b | c | 52 |
a | b | c | 52 |
a | b | c | 53 |
a | b | c | 53 |
a | b | c | 53 |
a | b | c | 53 |
a | b | c | 53 |
a | b | c | 53 |
a | b | c | 53 |
a | b | c | 53 |
a | b | c | 53 |
a | b | c | 53 |
a | b | c | 54 |
a | b | c | 54 |
a | b | c | 54 |
a | b | c | 54 |
a | b | c | 54 |
a | b | c | 54 |
a | b | c | 54 |
a | b | c | 54 |
a | b | c | 54 |
a | b | c | 54 |