View Single Post
Old 12-17-2007, 04:15 PM   #6 (permalink)
exam
Contributing Member
 
exam's Avatar
 
Join Date: 04-20-06
Posts: 333
iTrader: 0 / 0%
Latest Blog:
None

exam is a highly respected web proexam is a highly respected web proexam is a highly respected web proexam is a highly respected web proexam is a highly respected web proexam is a highly respected web proexam is a highly respected web proexam is a highly respected web proexam is a highly respected web proexam is a highly respected web proexam is a highly respected web pro
Quote:
Originally Posted by Boogle View Post
I agree, you don't need to use auto_increment. You should make your own ID column and run a query that checks for the highest value within it then use

Code:
ID = HIGHEST VALUE + 1
That's the way i would do it. But why do these gaps in the ID matter anyway?Surely people aren't seeing your primary key/mainID ? You should be using a seperate reference ID for the clients to see?

Boog's
I never said not to use an auto_increment. In fact I think he should use auto_increment. Also, what you've described will work just like an auto incrementing column, with the exception that if the last record is deleted and then you add an new one the id will be reused. If you delete any but the last record, that ID won't be reused.


Quote:
Originally Posted by Capo64 View Post
Thanks, I won't use auto_increment. No, they don't see my primary key, and I guess you're right, it's not a huge deal, but I'd just prefer for there not to be gaps in the numbers
Preferring that there not be gaps in the numbers is a *bad* reason to do what you're thinking of doing. Use an auto incrementing column. For your own sanity, and for anyone else maintaining your code, do it.

Quote:
Originally Posted by Jesse Vlasveld View Post
I don't see the problem of skipping a number once in a time. It keeps nice track of you're total records you've ever had in that particular table row.
I agree.
exam is offline   Reply With Quote