Database - TRUNCATE & DELETE


create table cric(id int identity(1,2),cname varchar(30))
insert into cric values('siva')
insert into cric values('Ranbhir')
insert into cric values('Karthik')
select *from cric
--the identity automatically assigns the value to the id.
it starts with 1 and increment by 2.

delete from cric

insert into cric values('siva')
insert into cric values('Ranbhir')
insert into cric values('Karthik')

select *from cric
--delete does not deletes the identity of the table.

truncate table cric

insert into cric values('siva')
insert into cric values('Ranbhir')
insert into cric values('karthik')

select *from cric
--truncate deletes the identity of the table.

Comments

Popular posts from this blog

How to set Java Object into JaxBElement ?

GitLab