Try OpenEdge Now
skip to main content
DataServer for Microsoft SQL Server
The DataServer Tutorial : Managing server attributes : Defining a default constraint definition
 

Defining a default constraint definition

The following procedure describes how to define a default constraint definition. Alternately, you can define default constraint definitions during migration.
To define a default constraint definition:
1. Start Data Administration and connect to the OpenEdge database you are migrating.
2. Select DataServer > MS SQL Server Utilities > Server Attributes > View/Maintain Foreign Constraints.
The View/Maintain Foreign Constraint Definitions dialog box appears.
3. Select the table where you are defining a default constraint definition and click Create Constraints.
The Create Foreign Constraint Definitions for tablename dialog box appears, as shown in Figure 18.
4. Select DEFAULT from Constraint Type.
The Create Foreign Constraint Definitions for tablename dialog box, is modified as shown in the following figure.
Figure 22. Create Foreign Constraint Definitions for tablename dialog box for default constraint definitions
5. Accept the default constraint definition name, or enter a new one.
6. Select a field from the Field list.
7. By default, the default constraint definition has the Active check box selected. Leave this box selected if you want the constraint definition you are defining to be available for migration.
8. A default constraint definition is a server-side validation. Enter a value for server-side population of the field in the Constraint Expression.
Caution: The expressions entered are not checked for correct syntax. If the expression is not valid on the server, the default constraint definition is rejected when building default constraint definition objects on the server.
For fields with an Initial Value, the Constraint Expression is populated with the initial value. The Constraint Expression value for the Default constraint definition is not required to match the Initial Value, however, they should normally match as there may otherwise be conflicts regarding what value to use as the default when creating a server record. The initial value is used in a client-side template record when new records are created, and overrides default constraint definitions on the server side when records are created in an OpenEdge application. The default constraint definition is applied only when an initial value is not supplied by the template record of an OpenEdge application and the column is also left blank by the user when the record is created.
Note: Since default constraints are tied to the server column, non-OpenEdge applications will get their defaults from the constraint migrated from the default constraint definition.
9. Optionally, add a description of the constraint definition in the Description box.
10. Click OK to save the constraint definition and exit the dialog box. Click Create to save the constraint definition and remain in the dialog box and continue defining constraint definitions for the selected table.