SQLColumnChange - cDbUpdateFunctionLibrary
Changes a SQL table's column type and/or length.
Type: Function
Parameters: Integer hTable, String sColumnName, Integer iDataType, Integer iLength
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 SQL data types. See SQL Server Type Mappings |
iLength |
Optional. The length of the column. Only applicable for some field types like e.g. SQL_VarChar. |
iDecimals |
Optional. The precision of the column, aka number of decimals. Only applicable for some field types like e.g. SQL_Numeric or SQL_Decimal. |
Syntax
Function SQLColumnChange Handle hTable String sColumnName Integer iDataType Integer iLength
Call: |
Get SQLColumnChange SysTable.File_Number "ColumnName" SQL_VarChar 75 to bOK |
Description
Use it to change an existing table column. The iDataType can be any of the SQL 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 with the DataFlex Embedded database, use the ApiColumnChange function instead.
Example
Procedure OnUpdate
Boolean bOK
Get SQLColumnChange Order.File_Number "ColumnName" SQL_VarChar 75 to bOK
End_Procedure