Renjith V S

Renjith V S

  • NA
  • 317
  • 66k

How to delete middle row with primary key in a table?

Mar 26 2014 5:08 AM
Hi,
I have a SQL table user. It has 3 columns id(set as primary and Is Identity as Yes), name and password. When I enter data to the table the id became incremented. But on delete query only name and password will be deleted. I need to delete a particular row including the id. For example:

id:1 name:abc password:123
id:2 name:wer password:234
id:3 name:lkj password:222
id:4 name:new password:999

I need to delete the third column ie,
id:3 name:lkj password:222
But after deleting this row, the table should be shown as below.

id:1 name:abc password:123
id:2 name:wer password:234
id:3 name:new password:999

Answers (6)