First, I'm aware of this question which didn't get answered because what the OP was really trying to do was'nt incrementing an identity column
I've got an identity column with a current seed value of x, and I would like to reseed it to x+1 (ie I want my identity column to jump directly from x to x+2.
I know I can do that using the following command
create procedure IncrementSeedValue
(
@TableName varchar(255),
@IncrementValue int
)
as
SET TRANSACTION ISOLATION LEVEL SERIALIZABLE;
BEGIN TRANSACTION;
declare @v bigint
select @v = IDENT_CURRENT(@TableName)+@IncrementValue
DBCC CHECKIDENT (@TableName, RESEED, @v )
COMMIT TRANSACTION;
go
However, I've got a few questions :
- Is the isolation level "serializable" adequate here?
- Would that lead to problem if I'm using SQL Server mirroring
- Are there other pitfalls I should be aware of ?