Results 1 to 7 of 7
  1. #1
    Join Date
    Sep 2004
    Location
    Virginia, USA
    Posts
    98

    Unanswered: Can You Format "Autonumber"

    Can Autonumber be configured to start at zero?

  2. #2
    Join Date
    Aug 2002
    Location
    Northampton, England
    Posts
    266
    Yes you can. Use this method.

    You make an Append query that just appends a value from a parameter, to just the auto-number field (as long as no other fields are required), e.g.:

    PARAMETERS [Number] Long;
    INSERT INTO tblTablName ( AutonumberFieldName )
    SELECT [Number] AS Expr1;

  3. #3
    Join Date
    Dec 2002
    Location
    Préverenges, Switzerland
    Posts
    3,740
    no.

    auto cannot be configured to start anywhere. it will start at 1 or not at all (e.g. if you use a non-auto long field and insert a record with ID = 0, you cannot then convert the field to auto and hope for a backfill)

    some philosophers claim that keys should never have meaning - that way you can never be tempted to edit a key or force a key sequence to start from a particular value --- keys just do their job and sit there waiting to join tables: the serve no "meaningful" purpose. i'm not a philosopher, but i do follow that philosophy in my db.

    izy
    currently using SS 2008R2

  4. #4
    Join Date
    Dec 2002
    Location
    Préverenges, Switzerland
    Posts
    3,740
    DJN:

    my reply is the opposite of yours - i typed it before yours but got stuck in a phone call from the real world before i posted.

    please don't take my reply as an attack.

    izy
    currently using SS 2008R2

  5. #5
    Join Date
    Sep 2004
    Location
    Virginia, USA
    Posts
    98
    Thanks for all of the replies. The reason for me wanting a Zero is that I'm calculating responses in a survey and 0 was defined as N/A. I'll take a look to see the best way to do it. Thanks again for the replies. I've got a bit of thinking to do!

    KC

  6. #6
    Join Date
    Dec 2002
    Location
    Préverenges, Switzerland
    Posts
    3,740
    if you have a limited number of responses, you don't need auto at all:

    0:N/A
    1:Yes
    2:No
    3:Never Inhaled

    ....doesn't need an autonumber. a byte ID will do fine.

    izy
    currently using SS 2008R2

  7. #7
    Join Date
    Sep 2004
    Location
    Virginia, USA
    Posts
    98
    Izy,

    Thanks for the additional info/guidance. That is what I ended up doing.

    KC

Posting Permissions

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