Database auto-increment ID (set incrementation values)

Questions about the MySQL, PostgreSQL, and most other databases, as well as using it with PHP can be asked here.

Moderator: General Moderators

Post Reply
User avatar
kendall
Forum Regular
Posts: 852
Joined: Tue Jul 30, 2002 10:21 am
Location: Trinidad, West Indies
Contact:

Database auto-increment ID (set incrementation values)

Post by kendall »

Hello,

In an Access database you are able to alter the way Primary keys auto-increment values thus instead of starting at 1 you can start at 5746. Can this affect be achieved in MySQL?
what if i wanted to affix a alpha character at the beginning of each auto-incremented value?

Kendall
User avatar
twigletmac
Her Royal Site Adminness
Posts: 5371
Joined: Tue Apr 23, 2002 2:21 am
Location: Essex, UK

Post by twigletmac »

You can't put an alpha character in front of an auto-increment value (when you display it on a web page you could add it then though). You can change what number it starts from:

Code: Select all

ALTER TABLE tbl_name AUTO_INCREMENT = 1000
That code was from the user notes on:
http://www.mysql.com/doc/en/example-AUTO_INCREMENT.html

Mac
Post Reply