SitePoint Sponsor

User Tag List

Results 1 to 4 of 4

Hybrid View

  1. #1
    SitePoint Member
    Join Date
    Jul 2002
    Posts
    22
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Can you use mysql auto_increment on columns other than the primary key?

    We have a database which is a library catalogue of hard copy documents. One of the fields is named accession_number, whcih is like a kind of offline primary key but different from the actual database primary key which is of course an auto increment. Our app needs to be able to add one onto this number in an auto_increment type of way.

    I thought we might do this by using another auto_increment field. Is this possible and does anyone foresee any problems?

    Cheers
    Jonathan
    Last edited by jonnyporter; Apr 23, 2005 at 08:59.

  2. #2
    SitePoint Enthusiast
    Join Date
    Dec 2004
    Location
    texas
    Posts
    88
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    i'm 99% sure that you can only have one auto_increment field in a table.
    free online calendar: http://inversiondesigns.com
    includes multiple calendars/users/groups, task manager,
    email and sms reminders, permissions (sharing), etc.

  3. #3
    SitePoint Member
    Join Date
    Jul 2002
    Posts
    22
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    "more than one auto_increment" Not possible it seems

    Thanks for helping focus my thoughts. A quick search on google for "more than one auto_increment" indicates that its not possible to have more than one auto on a table.

    Thanks

    Jonathan

  4. #4
    SitePoint Wizard silver trophy someonewhois's Avatar
    Join Date
    Jan 2002
    Location
    Canada
    Posts
    6,364
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    And as of MySQL 4.1 (or is it 4.0, not sure) it forces you to have primary key for auto_increment, last I checked.


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •