Identity in sql 2008

Posted by Saratvaddilli under Sql Server on 11/1/2012 | Points: 10 | Views : 699 | Status : [Member] [MVP] | Replies : 3
I had a column with auto increment , when i delete some rows then a gap is forming i.e
suppose if we ten records i am deleting the 8th record then a gap is forming .
when ever i delete a record i want to reshuffle the identity of the column
please some one help.....

Thanks and Regards
V.SaratChand
Show difficulties that how difficult you are



Responses

Posted by: Sourabh07 on: 11/1/2012 [Member] Starter | Points: 25

Up
0
Down
hi..

Please refer the following link....

it might meet your expectations......

Ultimately, the concept behind it...is

SET IDENTITY_INSERT Table_Name OFF/ON

http://msdn.microsoft.com/en-us/library/aa259221%28v=SQL.80%29.aspx

Sourabh07

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

Posted by: Saratvaddilli on: 11/1/2012 [Member] [MVP] Bronze | Points: 25

Up
0
Down
thank you sourabh
but i need like this
suppose in my table emp having the records like these
 

empid emp_name autoincrement
1 sarat 1
2 sourabh 2
3 sheo 3

now if had deleted the 2nd record then the column values of the autoincrement should reshuffle i.e

empid emp_name autoincrement
1 sarat 1
3 sheo 2

Hope now i am clear with my question

Thanks and Regards
V.SaratChand
Show difficulties that how difficult you are

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

Posted by: Sourabh07 on: 11/1/2012 [Member] Starter | Points: 25

Up
0
Down
hi..

please refer to the following link......


it might be helpful for you......

http://msdn.microsoft.com/en-us/library/ms186775.aspx

Sourabh07

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

Login to post response