You can use the following to check the current identity seed:
dbcc checkident('dbo.Region');
Run that right after you create the table and you can see it's NULL--no identity has been seeded. After you perform inserts, though, it defaults to the first value, which is 1 (because you seeded the identity at 1). Do the inserts and after the two records are inserted, run the check statement again and you'll see that up to 3, which is your last inserted value.
I think you're seeing a side effect from the way that identity_insert works: it looks like it guarantees that the current value for an identity isn't NULL after a successful insert. If you pre-seed a region before doing your identity inserts, you'll see that 1 isn't skipped:
CREATE TABLE dbo.Region(
RegionId int IDENTITY(1,1),
RegionName varchar(100) NOT NULL
)
GO
insert into dbo.Region(RegionName) values('Region Zero');
SET IDENTITY_INSERT dbo.Region ON;
INSERT INTO dbo.Region (RegionId, RegionName) VALUES (-9, 'Unknown'), (-99, 'N/A');
SET IDENTITY_INSERT dbo.Region OFF;
INSERT INTO dbo.Region (RegionName) VALUES ('Region One'), ('Region Two');
dbcc checkident('dbo.Region');
GO
SELECT * FROM dbo.Region
drop table dbo.Region;
↧