Hello Nils,
Two questions about ApiColumnChange / SqlColumnChange.
My db is on a SQL server and I am using DUF v2.
1) SqlColumnChange won't never work if you don't change the column name?
SqlColumnChange calls SqlColumnChangeByTableName and inside this function there is this code
Code:
Get SQLUtilColumnExists sTableName sColumnName to bExists
If (bExists = True) Begin
Function_Return False
End
so you never do the conversion.
2) What datatype should I use with ApiColumnChange?
Code:
Move (bOk and ApiColumnChange(ghoDbUpdateFunctionLibrary, hTable, "MY_FIELD", DF_BCD_DUF, 10, 6)) to bOk // Wrong, I get the field converted to char(10)
Move (bOk and ApiColumnChange(ghoDbUpdateFunctionLibrary, hTable, "MY_FIELD", DF_BCD, 10, 6)) to bOk // Wrong, I get the field converted to char(10)
Move (bOk and ApiColumnChange(ghoDbUpdateFunctionLibrary, hTable, "MY_FIELD", SQL_NUMERIC, 10, 6)) to bOk // Ok, I get the field converted to numeric(10, 6)
Move (bOk and ApiColumnChange(ghoDbUpdateFunctionLibrary, hTable, "MY_FIELD", SQL_INTEGER, 8, 0)) to bOk // Wrong, ERROR 4097 en linea 29229: Attempting to set to Unknown [4], the only allowed values are DF_ASCII (0), DF_BCD (1), DF_DATE (2), DF_OVERLAP (3), DF_TEXT (5), DF_BINARY (6) and DF_DATETIME (7)
So, SQL_NUMERIC has worked because it is 2 and 2 = DF_DATE? but I see numeric(10, 6) at SQL management.
SQL_INTEGER fails, however I see the field changed at SQL management correctly
Maybe if is it a SQL table it is not correct put the same type in both attributes?
Code:
If (bIsSqlTable = False) Begin
Set_Attribute DF_FIELD_TYPE of hTable iColumn to iTypeFrom
End
Else Begin
Set_Attribute DF_FIELD_TYPE of hTable iColumn to iTypeFrom
Set_Attribute DF_FIELD_NATIVE_TYPE of hTable iColumn to iTypeFrom
End
Regards.