Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How Do I Append With Different Field Names?

Status
Not open for further replies.

kmm

Programmer
Dec 18, 2000
3
US
I need to append from table (table1) to (table2) however the field names are different. Does anyone have any suggestions on how to accomplish this? Thanks.

IE. (the field names do have the same field type)

Table 1 field = entered_by and table 2 field = v_ent_by
Table 1 field = loc and table 2 field = vloc
 
Try this


Select table1.entered_by as v_ent_by, ;
table1.loc as vloc ;
from table1 ;
into table temp

Select 0
Use table2
Append from temp
Delete file temp.dbf
Pete Bloomfield
Down Under
 
Pete's suggestion is probably the easiest, but you could also write out the source table to SDF, then APPEND FROM ... SDF in the second table; that way, field names don't matter at all - only position.

Robert Bradley

 
or you might try
use tabel1
insert into table2 (v_ent_by,vloc);
values (table1.entered_by,table2.loc)

problem is you have to list all fields you want to insert

or

use table1
scatter memvar
m.v_ent_by = entered_by
m.vloc = loc
use table2
append blank
gather from memvar

hope this helped!
jc
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top