Database Management
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me

The Shed is going Social! Join us on FaceBook and Twitter and chime in on the conversation.

Go Back   Dev Shed ForumsDatabasesDatabase Management

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old August 10th, 2011, 10:00 AM
matt1174 matt1174 is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Nov 2010
Posts: 18 matt1174 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
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?

Reply With Quote
  #2  
Old August 10th, 2011, 05:38 PM
E-Oreo's Avatar
E-Oreo E-Oreo is offline
Lost in code
Click here for more information.
 
Join Date: Dec 2004
Posts: 7,931 E-Oreo User rank is General 91st Grade (Above 100000 Reputation Level)E-Oreo User rank is General 91st Grade (Above 100000 Reputation Level)E-Oreo User rank is General 91st Grade (Above 100000 Reputation Level)E-Oreo User rank is General 91st Grade (Above 100000 Reputation Level)E-Oreo User rank is General 91st Grade (Above 100000 Reputation Level)E-Oreo User rank is General 91st Grade (Above 100000 Reputation Level)E-Oreo User rank is General 91st Grade (Above 100000 Reputation Level)E-Oreo User rank is General 91st Grade (Above 100000 Reputation Level)E-Oreo User rank is General 91st Grade (Above 100000 Reputation Level)E-Oreo User rank is General 91st Grade (Above 100000 Reputation Level)E-Oreo User rank is General 91st Grade (Above 100000 Reputation Level)E-Oreo User rank is General 91st Grade (Above 100000 Reputation Level)E-Oreo User rank is General 91st Grade (Above 100000 Reputation Level)E-Oreo User rank is General 91st Grade (Above 100000 Reputation Level)E-Oreo User rank is General 91st Grade (Above 100000 Reputation Level)E-Oreo User rank is General 91st Grade (Above 100000 Reputation Level)  Folding Points: 945 Folding Title: Novice Folder
Time spent in forums: 2 Months 7 h 48 m 54 sec
Reputation Power: 7053
What database system are you using? I would think that most database systems should enforce a unique constraint on an auto-number field automatically...
__________________
PHP FAQ
How to program a basic, secure login system using PHP

Quote:
Originally Posted by Spad
Ah USB, the only rectangular connector where you have to make 3 attempts before you get it the right way around

Reply With Quote
  #3  
Old August 11th, 2011, 02:59 AM
matt1174 matt1174 is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Nov 2010
Posts: 18 matt1174 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
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.

Reply With Quote
  #4  
Old August 11th, 2011, 05:05 AM
matt1174 matt1174 is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Nov 2010
Posts: 18 matt1174 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
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....

Reply With Quote
  #5  
Old August 11th, 2011, 05:37 AM
r937's Avatar
r937 r937 is offline
SQL Consultant
Click here for more information.
 
Join Date: Feb 2003
Location: Toronto Canada
Posts: 26,373 r937 User rank is General 47th Grade (Above 100000 Reputation Level)r937 User rank is General 47th Grade (Above 100000 Reputation Level)r937 User rank is General 47th Grade (Above 100000 Reputation Level)r937 User rank is General 47th Grade (Above 100000 Reputation Level)r937 User rank is General 47th Grade (Above 100000 Reputation Level)r937 User rank is General 47th Grade (Above 100000 Reputation Level)r937 User rank is General 47th Grade (Above 100000 Reputation Level)r937 User rank is General 47th Grade (Above 100000 Reputation Level)r937 User rank is General 47th Grade (Above 100000 Reputation Level)r937 User rank is General 47th Grade (Above 100000 Reputation Level)r937 User rank is General 47th Grade (Above 100000 Reputation Level)r937 User rank is General 47th Grade (Above 100000 Reputation Level)r937 User rank is General 47th Grade (Above 100000 Reputation Level)r937 User rank is General 47th Grade (Above 100000 Reputation Level)r937 User rank is General 47th Grade (Above 100000 Reputation Level)r937 User rank is General 47th Grade (Above 100000 Reputation Level) 
Time spent in forums: 3 Months 1 Week 2 Days 6 h 53 m 18 sec
Reputation Power: 4140
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???
__________________
r937.com | rudy.ca
please visit Simply SQL and buy my book

Reply With Quote
  #6  
Old August 11th, 2011, 09:14 AM
matt1174 matt1174 is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Nov 2010
Posts: 18 matt1174 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
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

Reply With Quote
Reply

Viewing: Dev Shed ForumsDatabasesDatabase Management > Autonumber c*ck up

Developer Shed Advertisers and Affiliates



Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 


Powered by: vBulletin Version 3.0.5
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.

© 2003-2013 by Developer Shed. All rights reserved. DS Cluster - Follow our Sitemap