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
Answers were Sorted based on User's Feedback
Answer / challa yerriswamy
set identity_insert <table_name> on
insert into text1(id,id_name) values(2,'insertedat2')
Is This Answer Correct ? | 13 Yes | 0 No |
Answer / 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 |
Answer / sunilkumar
set identity_insert on
insert into test1(Id ,id_name) values (2 ,'insertedat2')
Is This Answer Correct ? | 7 Yes | 3 No |
Answer / boby
insert into <table_name>(id,name) values(2,'e')ORDER BY ID
Is This Answer Correct ? | 1 Yes | 0 No |
Answer / 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 |
Answer / s pattnaik
SET IDENTITY_INSERT dbo.test1 OFF
Then
insert into test1(Id ,id_name) values (2 ,'insertedat2')
Is This Answer Correct ? | 6 Yes | 12 No |
What is an execution plan?
What are a database and a data warehouse?
What are the advantages of partitioning?
How can you insert null values in a column while inserting the data?
How can I get data from a database on another server?
what is a stored procedure and trigger?
Explain what are the restrictions that views have to follow? : SQL Server Architecture
you accidentally delete the msdb database what effect does this have on your existing sql databases, and how do you recover? : Sql server administration
How many types of TRIGGERS are there in MS SQL Server?
8 Answers CarrizalSoft Technologies, TCS, United Healthcare,
Why we need a group by clause?
How to create prepared statements using odbc_prepare()?
What is difference between index seek vs. Index scan?