Multiple unique keys


This content is archived and is not being updated. For the latest documentation, see Microsoft Dynamics 365 product documentation. For the latest release plans, see Dynamics 365 and Microsoft Power Platform release plans.


These release notes describe functionality that may not have been released yet. To see when this functionality is planned to release, please review What's new and planned for Dynamics 365 Business Central. Delivery timelines and projected functionality may change or may not ship (see Microsoft policy).

In AL, a key definition now includes the Unique property that you can use to create a unique constraint on the table in SQL Server. A unique key ensures that records in a table do not have identical field values. With a unique key, when a table is validated, the key value is checked for uniqueness. If the table includes records with duplicate values, the validation fails. Another benefit of unique indexes is providing information to the query optimizer that helps produce more efficient execution plans.

Like primary keys, you can create unique secondary keys that are composed of multiple fields. In this case, it's the combination of the values in the secondary key that must be unique. For example, if you have a Customer table, you could create a unique key for the Name, Address, and City fields to make sure that there are no customers that have the same combination of values for these fields. Unlike primary keys, it is possible to define multiple unique secondary keys on a table.

Tell us what you think

Help us improve Dynamics 365 Business Central by discussing ideas, providing suggestions, and giving feedback. Use the Business Central forum at