Insert range of numbers into an automatically SQL table

Asked

Viewed 312 times

1

The point is that I want to insert in a table field a range of numbers that goes from 100 to 1,000,000 and I didn’t want to be doing 1 to 1. How can I do this automatically?

In SQL Server

1 answer

1


I’ve already found an answer:

DECLARE @num INT = 100
WHILE(@num<200)
begin
INSERT  INTO [dbo].[tableName]([row1],[row2],[row3],[row4])
VALUES (@num,value2,value3,value4)
SET @num = @num + 1
end

Browser other questions tagged

You are not signed in. Login or sign up in order to post.