The Shed is going Social! Join us on FaceBook and Twitter and chime in on the conversation.
|
 |
|
Dev Shed Forums
> Databases
> Database Management
|
Autonumber c*ck up
Discuss Autonumber c*ck up in the Database Management forum on Dev Shed. Autonumber c*ck up Database Management forum discussing non-database specific SQL. Structured Query Language was designed to be a robust and standardized language for manipulating relational databases.
|
|
 |
|
|
|
|

Dev Shed Forums Sponsor:
|
|
|

August 10th, 2011, 10:00 AM
|
|
Registered User
|
|
Join Date: Nov 2010
Posts: 18
Time spent in forums: 2 h 37 m 25 sec
Reputation Power: 0
|
|
|
Autonumber c*ck up
Hi all
I have an issue with an autonumber field in a table.
Somehow, recently, the same number has been issued twice.
OK, I've realised this is an issue so want to change the field properties to indexed with no duplicates to ensure it doesn't happen again.
However, it won't let me change this while there are duplicate numbers in the table and I am unable to modify the numbers manually.
My next thought was to delete the relevant records, however as so much is linked throughout, it won't allow me to do that either.
Any suggestions?
|

August 10th, 2011, 05:38 PM
|
 |
Lost in code
|
|
|
|
|
What database system are you using? I would think that most database systems should enforce a unique constraint on an auto-number field automatically...
|

August 11th, 2011, 02:59 AM
|
|
Registered User
|
|
Join Date: Nov 2010
Posts: 18
Time spent in forums: 2 h 37 m 25 sec
Reputation Power: 0
|
|
|
I'm using Microsoft Access.
I too would have thought, that using Autonumber, it would have prevented itself from duplicating numbers.
I didn't set the properties to 'No Duplicates', but using Autonumber I wouldn't have thought it was necessary.
However, now the problem has occurred, as stated earlier, I can't delete the records due to the extensive relationships throughout, yet it won't let me manually adjust the numbers.
...and until I do one or the other, I can't implement a 'no duplicates' rule in the properties to prevent further errors.
I've tried chaning the field from autonumber to number, which allowed the editing of the numbers, yet it wouldn't then let me change it back to autonumber.
The reason this is an issue is because the field in question is a 'quote' number, therefore we don't really want duplicates.
|

August 11th, 2011, 05:05 AM
|
|
Registered User
|
|
Join Date: Nov 2010
Posts: 18
Time spent in forums: 2 h 37 m 25 sec
Reputation Power: 0
|
|
|
I've decided to bite the bullet on this one and delete the field, then add it again, with 'no duplicate' properties.
Not the ideal solution, but better now than later on when there's even more to go wrong....
|

August 11th, 2011, 05:37 AM
|
 |
SQL Consultant
|
|
Join Date: Feb 2003
Location: Toronto Canada
|
|
Quote: | Originally Posted by matt1174 I've decided to bite the bullet on this one and delete the field, then add it again, with 'no duplicate' properties. | what happened to "My next thought was to delete the relevant records, however as so much is linked throughout, it won't allow me to do that either" ?
even if it does let you delete the column and reassign the autonumbers, won't this create an even bigger c*ck up because the linked tables will then potentially point to the wrong rows???
|

August 11th, 2011, 09:14 AM
|
|
Registered User
|
|
Join Date: Nov 2010
Posts: 18
Time spent in forums: 2 h 37 m 25 sec
Reputation Power: 0
|
|
|
Thanks for your input on this - it seems ok for now - the autonumber was a 'quote' number which only relevant to a drawing number within the same table.
The autonumber field has no bearing on any of the links, so I think (hope) I've got away with that one
|
Developer Shed Advertisers and Affiliates
| Thread Tools |
Search this Thread |
|
|
|
| Display Modes |
Rate This Thread |
Linear Mode
|
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
|
|