Consultor Eletrônico



Kbase P26983: How to use 4GL to adjust the SQL Width Property Setting of a table field?
Autor   Progress Software Corporation - Progress
Acesso   Público
Publicação   16/09/2009
Status: Verified

GOAL:

How to use 4GL to adjust the SQL Width Property Setting of a table field?

GOAL:

How to programmatically change the SQL width using the _File and _Field metaschema tables

FACT(s) (Environment):

All Supported Operating Systems
Progress 9.x
OpenEdge 10.x

FIX:


/***************** IMPORTANT NOTE *****************/
/*** THE DATABASE MUST BE RESTARTED FOR THE CHANGE IN THE ***/
/*** FIELD's SQL-WIDTH TO TAKE EFFECT. ***/

DEFINE VARIABLE cTableName AS CHARACTER NO-UNDO.
DEFINE VARIABLE cFieldName AS CHARACTER NO-UNDO.

ASSIGN cTableName = "Customer"
cFieldName = "Name".

FIND FIRST _File WHERE _File._File-Name = cTableName NO-LOCK NO-ERROR.

IF NOT AVAILABLE(_File) THEN
MESSAGE "Table <" + cTableName + "> is does not exist in the database"
VIEW-AS ALERT-BOX INFO BUTTONS OK.
ELSE /* table exists */
FIND FIRST _Field OF _File WHERE _Field._Field-Name = cFieldName NO-ERROR.
IF NOT AVAILABLE _Field THEN
MESSAGE "Field <" + cFieldName + "> does not exist in table <" + cTableName + ">"
VIEW-AS ALERT-BOX INFO BUTTONS OK.
ELSE /* field exists */
ASSIGN _Field._Width = 50. /* Set appropriate value here */