SQL-WIDTH is used in Progress 9.x .df files;
MAX-WIDTH replaced
SQL-WIDTH in OpenEdge 10.x and later .df files.
Both SQL Width and Max Width are used in DBTOOL output available since Progress 9.1D06 where:
- SQL-Width is the current SQL Width for the field listed.
- Max-Width represents the size of the longest piece of data in the field.
The SQL-WIDTH / MAX-WIDTH value of a field represents
the total length of data that can be entered into the field via SQL. This is a hard limit primarily used with CHARACTER type fields.
SQL-WIDTH / MAX-WIDTH maps to _field._width, which indicates the SQL width.The width value is calculated when the field is first created. By default the initial value of
SQL-WIDTH/ MAX-WIDTH matches the formula:
ABL Format * 2.
Example.
ADD FIELD "Contact" OF "Customer" AS character
FORMAT "x(30)" <--- ABL Format INITIAL ""
LABEL "Contact"
POSITION 10
MAX-WIDTH 60 <--- SQL-WIDTH/ MAX-WIDTH = ABL Format * 2 HELP "Please enter a contact."
ORDER 110
SQL-92 context
Character fields defined in the ABL Data Dictionary are given a specific format. This format is a 4GL/ABL display-only format. It does not restrict the amount of data that can be stored in the field. The amount of data that can be stored in a field by the 4GL is nearly 32KB (31955 bytes) if that is the only field in the table. The maximum size of a record is 32KB.
The metaschema also contains a SQL Width for field definitions. This is required for SQL applications to know how much data is expected in the field. This is specifically for the SQL-92 engine, not the SQL-89 engine. In the metaschema, _field._width, maps to MAX-WIDTH in the database schema dump file ( .df)
DataServer context
The OpenEdge-to-MS SQL Server (resp. Oracle) migration utility uses either a field's format or width information (_width value in the _Field schema record) for the column length when it defines the field as an MS SQL Server column. During the migration process to MS SQL Server (resp. Oracle) the utility prompts for the format of the migrated field. One can either select the ABL field's format or the SQL Width information.