The purpose of an auto incrementing field is to provide a quick general purpose 
primary key field (if indexed) AND/OR an audit trail to track records 
deletions, usually in financial database management.  It is a bad programming 
practice to tamper with auto incrementation.  It is advisable to use some other 
source to calculate and determine the value for the type of information one 
wishes to store in a column.

ineuw

--- On Sat, 8/30/08, Pete <[EMAIL PROTECTED]> wrote:
From: Pete <[EMAIL PROTECTED]>
Subject: Re: [php-list] Auto Increment fields - MYSQL
To: php-list@yahoogroups.com
Date: Saturday, August 30, 2008, 2:30 PM










    
            In message <9a3273a00808300929y 510067c3ge8b57fa def65a835@ 
mail.gmail. com>

, Gordon Stewart <[EMAIL PROTECTED] com> writes

>Sometimes, I want to start from "1" and find the next number / record

>- that is available (this is normal..)

>

>but - what if I want to "temporariliy" start from record  10,000 ??



This sounds like bad design, and it sounds as though you are storing

problems up for yourself in the future.



Depending on your logic, 

EITHER add a field to the table, and have it set to High sequence or Low

Sequence, (I would use 1 and 2)

OR

create another table for the high sequence.  You can always join the

tables if you need a query that shows both.



>If the set command works, & I put

>

>SET insert_id = 10000;

>

>In the next INSERT - will it force the insert command to use record 10,000

>

>Or does it act like an auto-increment number, & insert 10,001  ???



10,000



The *next* insert after that will give you 10,001



I don't like SET insert_id, because you don't specify a table, and if

the code is ever changed, you have to !remember! to keep SET insert_id

with the INSERT that you want.



-- 

Pete Clark



Sunny Andalucia

http://hotcosta. com/Andalucia. Spain


      

    
    
        
         
        
        








        


        
        


      

[Non-text portions of this message have been removed]

Reply via email to