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 / qwerty

set identity_insert <table_name> on
insert into <table_name>(id,name) values(2,'e')
set identity_insert <table_name> off

Is This Answer Correct ?    12 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

You want to implement the one-to-many relationship while designing tables. How would you do it?

511


what is a self join? : Sql server database administration

526


Explain indexed views?

562


What do you understand by sql server agent?

534


Define candidate key, alternate key, and composite key.

538






Some queries related to SQL

591


Explain external key management in sql server 2008

504


What is the difference between char and varchar2 datatype in sql?

547


How to drop an existing user defined function in ms sql server?

568


How to rebuild the master database?

581


explain what is a deadlock and what is a live lock? How will you go about resolving deadlocks? : Sql server database administration

473


What are the advantages of having an index on the sql server?

546


What are the 7 disadvantages to a manual system?

515


How can we improve performance by using SQL Server profiler?

580


what is memory-optimized nonclustered indexes

561