If SET IDENTITY_INSERT is ON then if you try to delete the middle rows data and again if you try to add the new row it will take max(id)+1 for the new row not the middle rows values.
Inorder to insert middle rows manually you have to do it with by setting SET IDENTITY_INSERT to off.
SET IDENTITY_INSERT OFF
insert into emp(empid primary key,identity,sal,dept) values (6, your values).
then again try to on the IDENTITY_INSERT. then it will continue with taking id as
max(id)+1.
SET IDENTITY_INSERT ON
<pre lang="SQL">
SET IDENTITY_INSERT OFF
insert into emp(empid primary key,identity,sal,dept) values (6, your values).
SET IDENTITY_INSERT ON