Partager via


How to: Create Tables

Applies To: Microsoft Dynamics AX 2012 R3, Microsoft Dynamics AX 2012 R2, Microsoft Dynamics AX 2012 Feature Pack, Microsoft Dynamics AX 2012

Create tables to store data in by using the Application Object Tree (AOT).

Note

Before creating new tables, review the tables that ship with Microsoft Dynamics AX to determine whether you can use existing tables. For more information, see Application Tables.

Table fields are based on a primitive data type or an extended data type. For more information, see Primitive Data Types and How to: Create an Extended Data Type.

The AutoReport and AutoLookup groups are automatically created when you create a table. For more information, see Implementing Automatic Reports for Forms and How to: Add a Control with a Lookup Form.

To manage changes to AOT objects, a version control system is available. For more information, see Version Control System.

Create a Table

  1. In the AOT, expand the Data Dictionary node.

  2. Right-click the Tables node, and then select New Table.

  3. Right-click the table, and then click Properties.

  4. Rename the table by modifying the Name property.

  5. To specify the table as temporary, set the Temporary property to Yes. For more information, see Table Properties.

  6. Modify additional table properties, as needed. For more information, see Table Properties.

  7. To delete the table, right-click it, and then click Delete.

Add Fields to a Table

Note

You can delete only fields that do not contain data in any of the table records. You cannot modify the data type of an existing field.

  1. Right-click the Fields node of your table.

  2. Click New, and then choose a primitive data type to base your field on. If you plan to base the field on a specific extended data type, you must choose a primitive data type that the extended data type is based on.

  3. To base the field on an extended data type, set the ExtendedDataType property.

  4. Modify additional field properties, as needed. For more information, see Table Field Properties.

  5. To delete the field, right-click it, and then click Delete.

Aa882181.collapse_all(en-us,AX.60).gifRestart the AOS after Adding Fields to Tables

When you insert data in a table during development, the SQL statement you use to insert the data is cached in the AOS. Next you might add a new field to the table and persist the change to the database. This causes the SQL statement in the cache to become stale, because the statement is not updated to include the new field. If you reuse the stale statement, the new field is ignored, or an error might occur.

To avoid this problem, restart the AOS after you persist table schema changes to the database. The cache is empty when the AOS restarts.

See also

Use the Table Browser to View, Add, Modify, or Delete Records

How to: Add a Relation to a Table

How to: Create a Field Group

How to: Create an Index

Tables, Views, and Maps

Announcements: New book: "Inside Microsoft Dynamics AX 2012 R3" now available. Get your copy at the MS Press Store.