What I do is create a new dictionary with the new structure. Call NewDict.IsEqual(OldDict) and if not equal I perform a restructure on the table using the new dictionary and a field mapper (to make certain that the data is preserved). In short it comes down to this code (works for compatible fields)?:
procedure RestructureTable(aDatabase : TnxDatabase; const aTableName : String; aNewDict : TnxDataDictionary); var OldDict : TnxDataDictionary; Mapper : TnxTableMapperDescriptor; TaskInfo : TnxAbstractTaskInfo; Completed : Boolean; TaskStatus : TnxTaskStatus; begin OldDict := TnxDataDictionary.Create; try if aDatabase.GetDataDictionaryEx(aTableName, '', OldDict) <> DBIERR_NONE then Exit; if OldDict.IsEqual(aNewDict) then Exit; Mapper := TnxTableMapperDescriptor.Create; try Mapper.MapAllTablesAndFieldsByName(OldDict, aNewDict); Check(aDatabase.RestructureTableEx(aTableName, '', aNewDict, Mapper, TaskInfo)); if Assigned(TaskInfo) then try while True do begin TaskInfo.GetStatus(Completed, TaskStatus); Application.ProcessMessages; if Completed then break; end; finally TaskInfo.Free; end; finally Mapper.Free; end; finally OldDict.Free; end; end;