I want to write a SQL query that inserts incremental numbers that start in specific number (for example 100) and ends at another specific number (for example 3000) into a column of a table in SQL Server, but I don't know how to do this.
For example:
I want to insert 100 to 3000 into categoryID
(column) from Category
(table)
Thank you very much
DECLARE @id INT
SET @id = 100
WHILE (@id <= 300)
BEGIN
insert into categories (categoryID) values (@id)
SELECT @id = @id + 1
END
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With