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 |
Explain the commands in sql server?
Why use “nolock” in sql server?
Can you name some of the dml commands in sql?
What is the difference between a local and a global variable?
Explain what are the basic functions for master, msdb, model, tempdb databases?
What are the differences between char and nchar in ms sql server?
Do you know what are acid properties?
Can a cursor be updated? If yes, how you can protect which columns are updated?
What are the tool windows in sql server management studio? : sql server management studio
Explain what is meant by replication of database?
What is deploy, process and build? : sql server analysis services, ssas
You notice that the transaction log on one of your databases is over 4gb the size of the data file is 2mb what could cause this situation, and how can you fix it?
Oracle (3259)
SQL Server (4518)
MS Access (429)
MySQL (1402)
Postgre (483)
Sybase (267)
DB Architecture (141)
DB Administration (291)
DB Development (113)
SQL PLSQL (3330)
MongoDB (502)
IBM Informix (50)
Neo4j (82)
InfluxDB (0)
Apache CouchDB (44)
Firebird (5)
Database Management (1411)
Databases AllOther (288)