Database.AlterKey(KeyRef, Boolean) Method
Version: Available or changed with runtime version 13.0.
Alter a table's key in SQL, either disabling or enabling it. Any alteration only pertains to the current transaction and will be reverted at the end of the current transaction. Any alteration will fail if it's called on System or non-SQL based tables. Disabling clustered or unique keys is also not supported and will fail at runtime.
Note
This method is supported only in Business Central on-premises.
Syntax
Database.AlterKey(KeyRef: KeyRef, Enable: Boolean)
Note
This method can be invoked without specifying the data type name.
Parameters
KeyRef
Type: KeyRef
A keyref of the key to alter.
Enable
Type: Boolean
Whether to enable or disable a key. Keys that are created as disabled cannot be enabled.
Related information
Database Data Type
Getting Started with AL
Developing Extensions