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 wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

FoxPro Database Updates

Status
Not open for further replies.

youwannawhat

Programmer
Oct 3, 2001
43
US
I have imported a file into Fox and am faced with several 8.0 numerics that I must convert to dates. I've parsed the field and performed queries to build a table containing the date field in the format that I wish, but I've always had problems with the update queries. How can I update "newfield" in table a with the corresponding date values from "converted_field" in table b where a.otherfield = b.otherfield and a.otherfield2 == b.otherfield2?
Is this simple enough to be done with a few select-update queries, or will I have to build a more complex .prg?
 
Suggest you create an index on otherfield+otherfield2 for
b.DBF
USE a.dbf IN 1 ALIAS adbf
USE b.dbf ORDER nyNewIndex IN 2 ALIAS bdbf
SELECT adbf
SET RELATION TO otherfield+otherfield2 IN bdbf
REPLACE ALL newField WITH bDbf.whateverField


Hope this helps :) ramani :-9
(Subramanian.G)
FoxAcc
ramani_g@yahoo.com
LET KNOW IF THIS HELPED. ENOUGH EXPERTS ARE HERE TO HELP YOU OUT! BEST OF LUCK :)
 
OR:

SELECT <TableB>
INDEX ON OtherField + OtherField2 TAG PKey

UPDATE <TableA> ;
SET <TableA>.NewField = <TableB>.Converted_Field ;
WHERE INDEXSEEK(<TableA>[/I].OtherField + <TableA>.OtherField2, .T., <TableB>, &quot;PKey&quot;)

*** Table B is still selected
DELETE TAG PKey && this is optional

Regards,
Thom C.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top