ApiColumnChange - cDbUpdateFunctionLibrary

Changes a table's column type and/or length.


Type: Function


Parameters: Handle hTable, String sColumnName, Integer iDataType, Integer iLength, Integer  iDecimals

Parameter

Description

hTable

A file handle to the table name. Same as the Filelist.cfg slot number. Note: If instead need to pass the table name as a string you can use the SQLColumnChangeByTableName function.

sColumnName

The column name to be changed

iDataType

Any of the framework replacement data type constants or  SQL data types. Note: Do NOT use any of the standard DataFlex data types, such as DF_ASCII, DF_BCD, DF_DATE etc. See Mapping of SQL Data Types.

iLength

Optional. The length of the column. Only applicable for some field types like e.g. DF_BCD_DUF, DF_DATE_DUF or DF_ASCII_DUF.

iDecimals

Optional. The precision of the column, aka number of decimals. Only applicable for some field types like e.g. DF_BCD_DUF or DF_ASCII_DUF.


Syntax


Function ApiColumnChange Handle hTable String sColumnName Integer iDataType Integer iLength

Call:

Get ApiColumnChange SysTable.File_Number "ColumnName" DF_ASCII_DUF 30



Description

Use it to change an existing table column. The iDataType can be any of the data types defined in DataFlex. The iLength and iDecimals parameter are optional, unless a data type that are not "fixed" in length is passed.

Note: If you want to change a field/column for an SQL table, use the SQLColumnChange function instead.


Example


Procedure OnUpdate

    Boolean bOK

   

    Get ApiColumnChange Order.File_Number "NewColumnName" DF_ASCII_DUF 75 to bOK


End_Procedure