Link to home
Start Free TrialLog in
Avatar of 3636
3636

asked on

SQL row will automatically generate a row # but will not revert to it after deletion of that row.

When selecting “Edit Top 200 Rows” and adding another line of info to the table it works fine and automatically added a consecutive # to the “Ithgschool_Ext_ID” column.
But when I delete the newly added row, the next time I insert another new row, the consecutive # is skipped. In this case there are rows 1, 2, and jumps straight to 5.
Now, if I delete row 5, the next time I insert another row, that column will automatically generate the number 6, so it will show 1, 2, and 6.
How can I have the consecutive order show up again?


(see screen shot)
Rows-in-SQL.docx
SOLUTION
Avatar of Rich Weissler
Rich Weissler

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of 3636
3636

ASKER

1 -

I tried to manually change the number to the consecutive order but it will not change,
make sure Num Lock is on.

2-

What advantage do you get having "SET IDENTITY_INSERT ON"?


3-

Will NOT having consecutive numbers in that column reflect any behavior in the .net Application this database is supporting?

Thanks.
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of 3636

ASKER

1 - Table definition - see attachment.
3-  why do you think you need consecutive numbers without gaps... - because it done not make sense to have row #  1,2, and 6, without 3,4, and 5, when 3,4, and 5 have been deleted.

I mean, why should the unused row #s not be able to appear again in the table?
Table-definition.docx
ASKER CERTIFIED SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial