Inilah yang saya gunakan, modifikasi saja sesuai kebutuhan. Di sini, saya menambahkan banyak nomor urut ke tabel menggunakan variabel loop:
USE MyDB
GO
DECLARE @MyCounter as INT
SET @MyCounter = 1 -- to use this multiple times you can just
-- change the starting number and run again
-- if you do not want duplicate numbers
WHILE @MyCounter < 1000 -- any value you want
BEGIN
INSERT INTO [MyDB].[dbo].[MyTable]
([NumberField])
VALUES
(@MyCounter) -- insert counter value into table
set @MyCounter = @MyCounter + 1; -- increment counter
END