>>alter table toTable add column note1 memo >>&& make sure this field does not already exist, using a procedure for this purpose. >>USE fromTable IN 0 >>SELECT fromTable >>INDEX on thisID UNIQUE TO indexID && the key field >>SELECT fromTable && the memo field is in this table >>SCAN >> findThisID = thisID >> SELECT toTable && insert the memo field in this table >> IF SEEK(findThisID) >> REPLACE note1 WITH fromTable.note1 >> && all other rows/fields are unique as a result of using a select distianct * ... into table toTable >> && but the memo field is missing. So, find the key field and its memo in the fromTable >> && then insert the memo into the toTable. >> endif >>ENDSCAN >>>
do setField3 with "updateTabl", "key_col", "fromTable", "update_Col" PROCEDURE setField3 with toTable, keyField1,fromTable2, changeField PARAMETERS toTable, keyfield1,fromTable2, changeField SELECT &toTable REPLACE ALL &changeField WITH "" && to table and set field h=toTable f=keyField1 where1 = h + "." + f h=fromTable2 f=keyField1 where2 = h + "." + f h=toTable f=changeField setKey = h + "." + f h=fromTable2 f=changeField setKey2 = h + "." + f *? &h Update &toTable From &&fromTable2 ; Where &where1 = &&where2 ; Set &setKey = &&setKey2 *USE &toTable *BROWSE WIDTH 10 FONT "courier", 24 TITLE " after the update in procedure" *wait ENDPROC