How do I define the initial value and stepping value of an AutoNumber field?

Source: Internet
Author: User
Tags define sql query
Question: How do I define the initial values and stepping values for AutoNumber fields? How do I define the initial values and stepping values for automatically increasing fields? How do I reset the start value of an automatically added field that has deleted data from 1? Answer: With the following statement, you can specify its starting and stepping values when the table is being built: CREATE table TblNewOrder2 (OrderId autoincrement (1000,), ItemId Long, Quantity long) you You can also modify the next starting and stepping values with the following statement: ALTER TABLE Tblorder alter COLUMN OrderId COUNTER (2000, 50) to start again: ALTER TABLE TableName ALTER Colum The N OrderId COUNTER (1, 1) is in the VBE interface with the following code: DOCMD.RUNSQL "alter TABLE tablename ALTER COLUMN OrderId COUNTER (1, 1)" Here's the note from Dynamic numbering is often used as a uniqueness for identifying records, but when Jet uses DDL statements to change automatic numbering without guaranteeing that the modified AutoNumber is still unique, there is the phenomenon of duplicate identification numbers. To avoid this phenomenon it is best to set the automatic number as the primary key, or not to repeat. Please realize this Jet won ' t prevent you to altering AutoNumber seed and increment values that produce values . However, if the AutoNumber column has been designated as the primary key or it contains a unique index, you'll be Preven Ted from saving rows with duplicates. However, these operations require JET 4.0. If you don't use queries or JET SQL to refer to the animations in the following article http://access911.net/index.asp?board=4&recordid=77FAB11E1ADC how to use the Query Design Wizard to create a query http ://access911.net/eg/swf/createquery.swf How to run a JET SQL code http://access911.net/eg/swf/runsql.swf





Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.