Example

when create table that time identity is 1

After Insert two records the identity is increase 2 then rollback the insert statement identity i snot rollback

Identity column is not rollback

USE TEST1
create table sample
(
id int identity(1,1),
name varchar(100)
)

select IDENT_CURRENT(‘sample’)
–Here Identity as 1

begin tran
insert into sample(name)
select ‘udhaya’ union
select ‘ganesh’
rollback

select IDENT_CURRENT(‘SAMPLE’)

–Here Identity as 2

Advertisements