📜  MS Access-数据类型

📅  最后修改于: 2020-11-20 05:21:27             🧑  作者: Mango


表中的每个字段都有属性,这些属性定义了字段的特征和行为。字段最重要的属性是其数据类型。字段的数据类型决定了它可以存储哪种数据。 MS Access支持不同类型的数据,每种类型都有特定的用途。

  • 数据类型确定用户可以在任何给定字段中存储的值的类型。
  • 每个字段只能存储仅包含一种数据类型的数据。

以下是在典型的Microsoft Access数据库中可以找到的一些最常见的数据类型。

Type of Data Description Size
Short Text Text or combinations of text and numbers, including numbers that do not require calculating (e.g. phone numbers). Up to 255 characters.
Long Text Lengthy text or combinations of text and numbers. Up to 63, 999 characters.
Number Numeric data used in mathematical calculations. 1, 2, 4, or 8 bytes (16 bytes if set to Replication ID).
Date/Time Date and time values for the years 100 through 9999. 8 bytes
Currency Currency values and numeric data used in mathematical calculations involving data with one to four decimal places. 8 bytes
AutoNumber A unique sequential (incremented by 1) number or random number assigned by Microsoft Access whenever a new record is added to a table. 4 bytes (16 bytes if set to Replication ID).
Yes/No Yes and No values and fields that contain only one of two values (Yes/No, True/False, or On/Off). 1 bit.
  • 如果使用早期版本的Access,您会注意到其中两种数据类型有所不同。

  • 在Access 2013中,我们现在有两种数据类型-短文本和长文本。在早期版本的Access中,这些数据类型称为文本和备注。

  • 该文本字段称为短文本,而您的备注字段现在称为长文本。

这是一些其他更特殊的数据类型,您可以在Access中选择。

Data Types Description Size

Attachment

Files, such as digital photos. Multiple files can be attached per record. This data type is not available in earlier versions of Access.

Up to about 2 GB.

OLE objects

OLE objects can store pictures, audio, video, or other BLOBs (Binary Large Objects)

Up to about 2 GB.

Hyperlink

Text or combinations of text and numbers stored as text and used as a hyperlink address.

Up to 8,192 (each part of a Hyperlink data type can contain up to 2048 characters).

Lookup Wizard

The Lookup Wizard entry in the Data Type column in the Design view is not actually a data type. When you choose this entry, a wizard starts to help you define either a simple or complex lookup field.

A simple lookup field uses the contents of another table or a value list to validate the contents of a single value per row. A complex lookup field allows you to store multiple values of the same data type in each row.

Dependent on the data type of the lookup field.

Calculated

You can create an expression that uses data from one or more fields. You can designate different result data types from the expression.

You can create an expression that uses data from one or more fields. You can designate different result data types from the expression.

这些都是在Microsoft Access表中创建字段时可以选择的所有不同数据类型。