Reset auto Id Column of a Table

Posted by Manoj_B under Sql Server on 6/2/2013 | Points: 10 | Views : 1357 | Status : [Member] | Replies : 1
Please help me, it's urgent.

I have below table. after insert data it looks like this.

Id Name Age
-----------------------------
1 Manoj 23
2 Rahul 25
3 Rohit 22
4 Sunita 24

After delete one record,

Id Name Age
-----------------------------
1 Manoj 23
2 Rahul 25
4 Sunita 24



After delete one row, i want auto reset id column . how i will solve this problem. please help me.


Id Name Age
-----------------------------
1 Manoj 23
2 Rahul 25
3 Sunita 24

Thanks & Regards
Manoj Kumar



Responses

Posted by: Pandians on: 6/3/2013 [Member] [MVP] Silver | Points: 25

Up
0
Down
1. The column marked as "Read-Only" once we set IDENTITY property on that column (But, It can be Forcibly INSERTED incase SET IDENTITY_INSERT *** ON)

2. The Table has to be DROPPED and RE-CREATED without IDENTITY property If we want to change that column value

Attention: Normally, IDENTITY property used to ensure UNIQUEness of the Data.

Cheers
www.SQLServerbuddy.blogspot.com
iLink Multitech Solutions

Manoj_B, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response