Usage of Keys in Business Central

Usage of Keys in Business Central:

Dynamics 365 BC application use SQL database. SQL database uses keys to identify records in the table. It also uses indexes to speed up the performance of table data.

In AL, a key is a sequence of one or more field IDs from a table. There are two types of Keys in AL i.e.

(1) Primary Key- Primary Key is a unique key. It is only one in a table. It cannot be defined in the table extension.

(2) Secondary Key- Secondary Key created indexes in SQL. It can be multiple of 40 (including Primary Key). It can define in both Table objects and table extension objects.

(3) The clustered property isn’t supported in table extension objects.

(4) The unique property isn’t supported in table extension objects.

Defining new Keys:

keys
{
                                key(Name1; Fields)
                                {
 
                                }
                                key(Name2; Fields)
                                {
 
                                }
}
Defining new Keys in Dynamics 365

The total number of keys in a table is 40.

Points to be Remember when a modification in the key is made:

  • Don’t delete primary keys.
  • Don’t add or remove primary key fields, nor change their order.
  • Don’t change properties of existing primary keys.
  • Don’t add more unique keys.
  • Don’t add more clustered keys.
  • Don’t add keys that are fields of the base table.

How to Move fields in Page via AL Extension in D365 BC
Error while Publishing Extension or downloading AL Symbol in Dynamics 365- Solved
Main Features of Dynamics 365 Business Central
Extension Fields Not Visible in Page in D365 WebClient- Solved
Viewing Table Data– Microsoft Docs

Leave a Reply