here id col have primary key and identity
id name
1 a
2 b
3 c
4 d

delete 2nd row then o/p will be

id name
1 a
3 c
4 d

next inssert 2nd row and i want o/p will be
id name
1 a
2 e
3 c
4 d

Answer Posted / sunilkumar

set identity_insert on
insert into test1(Id ,id_name) values (2 ,'insertedat2')

Is This Answer Correct ?    7 Yes 3 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

difference between Clustered index and non clustered index ?

581


Can you please explain the difference between primary keys and foreign keys?

658


Explain for xml explicit mode?

567


How do you identify a foreign key?

601


role of sql sever 2005 in database rather than any other database

1512






What happens if you insert a duplicate key for the primary key column in ms sql server?

532


How can we determine what objects a user-defined function depends upon?

518


What are the purposes and advantages stored procedure?

499


Sql server reporting services vs. Crystal reports.

96


what kind of lan types do you know? : Sql server database administration

519


What does null mean?

601


What is the difference between ‘having’ clause and a ‘where’ clause?

551


What are actions, how many types of actions are there, explain with example? : sql server analysis services, ssas

542


What is the importance of a recovery model?

611


How to get a list all databases on the sql server?

583