auto increment value starting from n 
Author Message
 auto increment value starting from n

Hi,

I'm using PHP+MySql and I have defined a column as auto increment. I was
wondering what might be the easiest way to define the minimum (starting)
number for that auto increment value? I for example want to start customer
ids starting from 10000.

I didn't find an answer from php.net of mysql.com.

    Juha



Mon, 14 Mar 2005 15:06:32 GMT  
 auto increment value starting from n
i don't knwo if it will work - but try to insert 10000 dummy rows - then
del them - and i think the next inserted row will have the id 10000

mfG
Wolfi

Quote:
> Hi,

> I'm using PHP+MySql and I have defined a column as auto increment. I was
> wondering what might be the easiest way to define the minimum (starting)
> number for that auto increment value? I for example want to start customer
> ids starting from 10000.

> I didn't find an answer from php.net of mysql.com.

>     Juha



Mon, 14 Mar 2005 16:08:27 GMT  
 auto increment value starting from n

Quote:

> Hi,

> I'm using PHP+MySql and I have defined a column as auto increment. I was
> wondering what might be the easiest way to define the minimum (starting)
> number for that auto increment value? I for example want to start customer
> ids starting from 10000.

With mysql it's:

insert into mytable (id) values(100000)

Now the next id will be incremented to 100001

----- stephan
Registered Linux User #71917 http://counter.li.org
I speak for myself, not my employer. Contents may
be hot. Slippery when wet. Reading disclaimers makes
you go blind. Writing them is worse. You have been Warned.



Mon, 14 Mar 2005 16:28:19 GMT  
 auto increment value starting from n

Quote:

> Hi,

> I'm using PHP+MySql and I have defined a column as auto increment. I was
> wondering what might be the easiest way to define the minimum (starting)
> number for that auto increment value? I for example want to start customer
> ids starting from 10000.

insert into customer (id, name) values (9999, 'dummy customer');

the next
  insert into customer (name) values ('another dummy customer');
will assign id 10000 to "another dummy customer"

hth
--
I used to be a kid, now I'm not so sure
         ... the right.domain is HotPOP



Mon, 14 Mar 2005 16:45:37 GMT  
 auto increment value starting from n

Quote:
> I'm using PHP+MySql and I have defined a column as auto increment. I was
> wondering what might be the easiest way to define the minimum (starting)
> number for that auto increment value? I for example want to start customer
> ids starting from 10000.

ALTER TABLE tbl_name AUTO_INCREMENT = 10000;

run that sql statement.  Should do the trick (without having to insert a
bunch of dummy values).

regards,
reggie



Tue, 15 Mar 2005 17:48:14 GMT  
 
 [ 5 post ] 

 Relevant Pages 

1. Auto Increment

2. Auto-increment on dBase-table

3. Auto increment record

4. Auto Increment Error

5. CW2003:Auto-increment 9,999,999,999?

6. Auto Increment Key Problem

7. Auto increment Error: Creates Duplicate Key (40)

8. Auto Increment Build Number

9. Auto Increment Error

10. Auto Increment

11. non-unique auto increment

12. Prime record fields on insert - Before adding auto incremented record

 

 
Powered by phpBB® Forum Software