Check Constraints

Top  Previous  Next

ModelRight allows you to create both Table and Column Check Constraints.  A Check Constraint object is owned by the Table or Column that it is applied to.  You can also create Check Constraint Templates so that you can specify a constraint in one place and then reuse it throughout your Model - via inheritance.  To have a Column or Table Check Constraint reuse a Check Constraint Template, simply select it in the Inherit control.   In ModelRight, a Table Check Constraint can either be an Expression or a Script:

 

An Table Check Constraint of type Expression

An Table Check Constraint of type Expression

 

A Table Check Constraint of type Script

A Table Check Constraint of type Script

Expression - enter a Boolean expression involving the Table's Columns.  Double-click on a Column in the Available Columns control to add the Column's name to the Expression edit control.

Script - enter a VB Script that will be evaluated to produce the Check Constraint.

 

A Column Check Constraint contains a few more options: Min/Max, Valid Values List, and Not Null:

Part of the Column Check Constraint Page with Min/Max selected.

Part of the Column Check Constraint Page with Min/Max selected.

 

Part of the Column Check Constraint Page with Valid Values List selected

Part of the Column Check Constraint Page with Valid Values List selected

Part of the Column Check Constraint Page when the Not Null option is selected.

Part of the Column Check Constraint Page when the Not Null option is selected.

Min/Max - specify a min condition and value and/or a max condition and value

Valid Values - Valid Value Lists are defined as independent objects (children of the Model) and just referenced/attached here.  To quickly create and attach a new Valid Values List object, click the Create New... button.

Not Null - a Not Null Column Check Constraint is automatically created and deleted by ModelRight  based on the NOT NULL checkbox control in the Column Property Page.