Create Table (in the access environment)

Source: Internet
Author: User
I am a beginner and recently studied CodeWhen using the Access database to create a data table by using code, the data fields automatically numbered are not added. I have read a lot of information online, mostly about SQL Server, there are too few access databases. You can search for a post in a classic forum and view it one by one. You can use it for verification, make sure that the following method is suitable for adding an automatic number field to the ACCESS database:
Create Table data table name (ID counter constraint primarykey primary key)
Note that the second primary contains spaces. In addition, the keywords are case insensitive.
Another method I recently discovered is:
SQL = "CREATE TABLE mytb (ID autoincrement (25, 1) primary key, age INT )"
Sql2 = "create table testtb (ID autoincrement, age int, email char, primary key (ID ))"
In access, autoincrement is an automatically numbered field, and () is the initial value and step value respectively. If no value is specified, the default value is. The primary key specifies the primary key, both methods can be specified.

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.