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 / pradeep aryan

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

Is This Answer Correct ?    0 Yes 3 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What can be used instead of trigger?

627


What is a dbms wizard?

618


Define normalisation?

676


How to reaname table name without using sp_Rename in sql server..?

530


How to connect php with different port numbers?

555






How should i optimize the time for execution of stored procedure having single input and many output from the different tables?

1469


Can a synonym name of a table be used instead of a table name in a select statement?

578


What is difference between clustered index and non clustered index?

628


How to loop through result set objects using mssql_fetch_array()?

543


How do you delete duplicate rows in sql server?

508


What is the Difference Between Primary and Foreign Key?

587


What is the language structure to add a record to a table?

581


What is hierarchy, what are its types and difference between them? : sql server analysis services, ssas

699


List out the difference between union and union all in sql server?

521


What are the Advantages of using CTE in sql server?

572