Try OpenEdge Now
skip to main content
DataServer for Microsoft SQL Server
Initial Programming Considerations : Database design issues : Initial value
 

Initial value

By default, the OpenEdge database generates an initial value of blank for character fields and zero for integer and decimal fields when they are created in an OpenEdge database table. Since the Include Defaults option, by default, is unchecked in the database migration dialog, the initial value does not get generated as a default value on the server. Therefore, you must select the Include Defaults checkbox to generate initial value.
After migration, when the field is created in an OpenEdge application, the field receives its initial value from the schema holder as it is adjusted against the original OpenEdge database, which has the initial value set to 0 for the integer fields and blank for the character fields. Note that the default value from the server is not used because in OpenEdge, the initial value in the schema holder takes precedence over the default value from the Server.
If a field with an initial value is also marked with the mandatory attribute, the field receives the NOT NULL constraint on the server, and if the Include Defaults option is not selected during migration, the server does not receive any information about the "initial values" in the OpenEdge schema holder. In a situation where you mark the mandatory attribute for a field but you do not select the Include Defaults option, that is, you have a mandatory field without a default value on the server; you might encounter problems such as OpenEdge run-time error 110.
Note: In such a situation, a field would be pulled back with the UNKNOWN value as its initial value; and because the field is mandatory, the NULL translation of the UNKNOWN value would now be invalid as an initial value for the mandatory column during record creation if you did not assign any value during record creation.
To avoid errors under such conditions, run the Adjust Schema utility against the original OpenEdge database on the tables where fields were originally migrated with the mandatory attribute but without the Include Defaults option selected. The utility appropriately adjusts the original OpenEdge initial value of the associated mandatory field in the schema holder.
For more information on migrating an OpenEdge database to MS SQL Server and the Adjust Schema Utility, see Migrating an OpenEdge database to MS SQL Server, and Adjust schemautility.