docs.intersystems.com
Home / Class Definition Reference / Class Definitions / Foreign Key Definitions

Class Definition Reference
Foreign Key Definitions
Previous section           Next section
InterSystems: The power behind what matters   
Search:  


Describes the structure of a foreign key definition.
Introduction
A foreign key defines a referential integrity constraint. When a table containing a foreign key constraint is modified, the foreign key constraints are checked.
You can add foreign key definitions to persistent classes. They are not meaningful in other kinds of classes.
Note that you can also enforce reference integrity by defining relationship properties that connect the classes.
Details
A foreign key definition has the following structure:
/// description 
ForeignKey name(key_props) References referenced_class(ref_index) [ keyword_list ]; 
Where:
Example
ForeignKey EmpKey(EmpId) References MyApp.Employee(EmpID) [ OnDelete = cascade ];
See Also


Previous section           Next section
View this book as PDF   |  Download all PDFs
Copyright © 1997-2019 InterSystems Corporation, Cambridge, MA
Content Date/Time: 2019-04-23 13:43:22