I had some training from Itzik Ben Ghan this month & was well worth the money. The brain has opened up & projects are flowing faster!.
(You can set @i to 1 and do a "@i +1" and you will have sequential numbers. )
Inserting Odd Numbers up to 100
SET NOCOUNT ON;
USE Tempdb;
GO IF OBJECT_ID('TmpValues') IS NOT NULL
DROP TABLE dbo.TmpValues;
GO
CREATE TABLE TmpValues(
ID INT PRIMARY KEY IDENTITY,
MyVal nvarchar(10) DEFAULT 'blah', InsertedNumber int );
DECLARE @i AS INT; SET @i = 1;
BEGIN TRANSACTION
-- I've seen another method use @<100>
WHILE @i < i =" @i" color="#33cc00">-- test:
-- SELECT * FROM dbo.TmpValues