SitePoint Sponsor

User Tag List

Results 1 to 2 of 2
  1. #1
    SitePoint Member
    Join Date
    Jan 2005
    Location
    Ira, MI
    Posts
    1
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    MS Access version of auto increment

    I've noticed some threads have been covering sort of the same thing, but I've tried all of the solutions and nothing has prevailed, I wanted to say that so you know I have searched and am not coming here without attempting to solve the problem myself.

    What I want to know is, what is the correct SQL syntax for defining a column of type "AutoNumber" in MS Access. In otherwords, this is an auto increment field. Most of the answers I have found or have been suggested have to do with the identity keyword, but I ran that in a query in MS Access, and it generated an error. If you can please explain or direct me to somewhere that covers creating a table and adding a column that auto increments, I would greatly appreciate it, thank you.

    btw, idk if this matters, but the SQL syntax is executed from a VB.net application which I am using in conjunction with my MS Access database.

  2. #2
    SQL Consultant gold trophysilver trophybronze trophy
    r937's Avatar
    Join Date
    Jul 2002
    Location
    Toronto, Canada
    Posts
    39,347
    Mentioned
    63 Post(s)
    Tagged
    3 Thread(s)
    Code:
    create table t
    ( id counter not null 
    , constraint pkey primary key (id)
    , foo varchar(11)
    , bar integer
    )
    rudy.ca | @rudydotca
    Buy my SitePoint book: Simply SQL
    "giving out my real stuffs"


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
  •