Welcome to SPN

Register and Join the most happening forum of Sikh community & intellectuals from around the world.

Sign Up Now!
  1.   Become a Supporter    ::   Make a Contribution   
    Target (Recurring Monthly): $200 :: Achieved: $98

Access 2003: Auto Increment Field

Discussion in 'Information Technology' started by MJMP, Nov 3, 2005.

  1. MJMP

    Expand Collapse

    I am starting to learn about SQL and had a question about the INSERT INTO

    For the sake of discussion, there is table titled SONG. It has three
    attributes: SongID (primary key, increment), SongName, and AlbumID. Note
    that the last SongID in the table is 12.

    And if we were interested in writing an INSERT INTO statement that adds a
    song called "Wanna Rock" with album ID of 4 into the table, we used:

    VALUES (13, 'Wanna Rock', 4)

    Will that automatically insert 13 into the SongID field if the field is set
    to increment? And what if there used to be a SongID of 14 and then a DELETE
    query was run, if you where to run an INSERT query, will Access use 14 or
    will it assign the next number of 15?

    I hope that made sense!
  2. Loading...

  3. Larry

    Expand Collapse

    Re: Access 2003: Auto Increment Field

    You asked: Will that automatically insert 13 into the SongID field if
    the field is set to increment? Yes, if by increment you mean the SongID
    field is set to "auto number." You should be able to write your SQL
    query as:

    INSERT INTO SONG (SongName, AlbumID)
    VALUES ('Wanna Rock', 4)

    and let Access do the numbering for you.
Since you're here... we have a small favor to ask...

More people are visiting & reading SPN than ever but far fewer are paying to sustain it. Advertising revenues across the online media have fallen fast. So you can see why we need to ask for your help. Donating to SPN's is vote for free speech, for diversity of opinions, for the right of the people to stand up to religious bigotry. Without any affiliation to any organization, this constant struggle takes a lot of hard work to sustain as we entirely depend on the contributions of our esteemed writers/readers. We do it because we believe our perspective matters – because it might well be your perspective, too... Fund our efforts and together we can keep the world informed about the real Sikh Sikhi Sikhism. If everyone who writes or reads our content, who likes it, helps us to pay for it, our future would be much more secure. Every Contribution Matters, Contribute Generously!

    Become a Supporter      ::     Make a Contribution     

Share This Page