How to set Identity Increment ON/OFF in SQL

In this artical i'm trying to explain how to fix identity value how to change the identity value and how to update that value with proper order using Identity column on / off.
Here i provide one simple example go through that example and check how it's working.

How to Set IDETITY ON/OFF

In this artical i'm trying to explain how to fix identity value how to change the identity value and how to update that value with proper order using Identity column on / off.

output:

6)but the id column is not in proper way for that reason we set identity to ON before inserting and add identity column manually then off the identity column after successfully inserted. Using this we get proper id value.

delete from #table where id in (7,8)

select * from #table

OutPut:

id name city1 naveen vijayawada2 radha bangalore3 sanjay chennai

7) Now I set identity on and insert some records then see the result output.

SET IDENTITY_INSERT #table ONinsert into #table(id,name,city)values(4,'kaavya','vijayawada'),(5,'kalpana','bangalore')SET IDENTITY_INSERT #table OFF