Data Types of Access database tables

Source: Internet
Author: User
Tags ole
In access, the remarks type is represented by memo, so the SQL statement for changing the field data type to the remarks is:
Alter table user alter column userinfo memo
By the way, if the user table has a foreign key and the field you want to modify is a foreign key, you cannot modify it!
The following shows how to modify the SQL statement to another type (the table is TB and the field is aa ):
Alter table tb alter column AA byte number [bytes]
Alter table tb alter column AA long number [long integer]
Alter table tb alter column AA short number [integer]
Alter table tb alter column AA single number [single precision
Alter table tb alter column AA double number [Double Precision]
Alter table tb alter column AA currency
Alter table tb alter column AA char text
Alter table tb alter column AA text (n) text, where n indicates the field size
Alter table tb alter column AA binary
Alter table tb alter column AA counter automatic number
Alter table tb alter column AA memo remarks
Alter table tb alter column aa time date/time

I. Data Types

The Access Database provides 10 Data Types for fields. Their usage and storage space are as follows:

1.Text Type(Text): used for InputCombine text or text with numbersThe maximum value is255Characters (bytes). The default value is50. In access,Each Chinese character and all special characters(Including Chinese Punctuation Marks)Is counted as one character..

Representation Method: UseSingle quotes ('') Or double quotation marks ("). For example, 'wang gang', 'accounting 2 class', and '123.

2.Currency type(Currency): used for storageCurrency value, Account8Bytes in computingRounding prohibited.

3.Number Type(Number): usedFor Numerical CalculationExcept for currency. Numeric Fields are divided into seven types: byte, integer, long integer, single precision, double precision, synchronous copy ID, and decimal number, 1, 2, 4, 4, 8, 16, and 12 bytes respectively.

Representation Method: Write directly. Example: 3246291

4.Date/Time type(Date/time): used for storageDate and (or) Time Value, Account8Bytes.

Representation Method: Enclosed by English character. Example :# 2010-02-25 #,# 02/25/2010 #,# 2010-02-25 #,# 2010-02-25 PM # And # Are valid representation methods. Note: there must be a space between the date and time.

5.Automatic numbering(Autonumber): used when a record is addedAuto-inserted sequence number(Increment by 1 or a random number). The default value is a long integer. You can also change it to a synchronous copy ID.Automatic ID cannot be updated.

6.Yes/No(Yes/No): Used to indicateLogical Value(Yes/No, true/false)1Bytes.

Representation Method:. T.. f. True False

7.Remark type(Memo): usedLong text or long text and numbers(Greater255 charactersCan contain a maximum of 65535 characters.

8.OLE object type(OLE object): used to create OLE objects in other programs using the OLE protocol (for exampleWord documents,Excel workbooks,Image,Sound). The maximum storage space is 1 GB (limited by disk space ).

9.Hyperlink(Hyper link): usedStore the hyperlink address, Stores up to 64000 characters.

10.View wizard type(Lockup wizard): LetYou can use a combo box or a list to select values from other tables or value lists,The actual field type and length depend on the data source.

Appendix A lists the applicability of all data types of access and their default widths (that is, the default bucket ).

Ii. How to Determine the field data type

1. Money-related, useCurrency typeWhich is irrelevant to money but requires numerical calculation.Number Type, Which does not require numerical calculation and does not exceed 255 charactersText Type, More than 255 charactersRemark type.

2. If there are only two definite values available, you can useYes/No. You can also use the text type. Other types, such as the date type, have obvious meanings and will not be described.

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.