Identity column is not rollback

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

Author: tdmsql

I am a PL-Sql Developer. I am searching some sites sql studies but its bored. i like create studies note my own way. so that i created this site.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s