I want to insert multiple rows based on a limit value into a SQL Server table which has a column called Sequence
.
The method which I am using is a WHILE
loop, and my code is:
Declare @Limit bigint = 1, @Increment bigint = 0
While (@Increment <= (@Limit))
Begin
Insert into MY_TABLE (Sequence) values (@Increment)
Set @Increment = @Increment + 1
End
Please, is there any other way in SQL to achieve this row insert case without using loops?