Results 1 to 3 of 3
  1. #1
    Join Date
    May 2005
    Posts
    8

    Unanswered: Creating an Autonumber field in SQL in Access?

    Hi,
    I'm trying to figure out if it is possible to create a table with a unique identifier in Access SQL.

    I have a table with two columns, say Award and Winner. I need to create a table with those two columns along with a 3rd column (ID) that is unique.

    The kicker is that, the autonumber will have to start from 1, each time i run it. That is why i can't just run a delete/append on an exsisting table.

    Hopefully, that makes sense! Any help is appreciated.

    Thanks in advance!

  2. #2
    Join Date
    Feb 2004
    Location
    One Flump in One Place
    Posts
    14,912
    Hi
    Quote Originally Posted by chriscolru
    Hi,
    I'm trying to figure out if it is possible to create a table with a unique identifier in Access SQL.
    Yup it sure is:
    Code:
    CREATE Table AutonumberExample (AutonumberCol AUTOINCREMENT(1, 1), TextCol Text(1))
    Quote Originally Posted by chriscolru
    The kicker is that, the autonumber will have to start from 1, each time i run it. That is why i can't just run a delete/append on an exsisting table.
    In that case your question might have been a different one
    Code:
    ALTER Table AutonumberExample ALTER AutonumberCol AUTOINCREMENT(1, 1)
    It is called "reseeding"

  3. #3
    Join Date
    May 2005
    Posts
    8
    Thanks! that worked great. Didn't know about AUTOINCREMENT.

Posting Permissions

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