Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Code to compare all fields in two tables
Message
 
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00943805
Message ID:
00943815
Views:
18
>Does anybody have some code to compare to copies of the same table field by field. Want to produce a report that would list the differences. The report would print the record key, field name, value1, value2.
>
>Thanks
>
>Brenda

Hi Brenda,

See message #727212

I would start from identifying the records which are different. I assume, you have the same IDs in both tables, but the rest of the data field could be different, right? Then I would try (from the top of my head):
select *, "Copy 1" as TableName from Copy1 ;
    UNION ;
select *, "Copy 2" as TableName from Copy2 ;
order by KeyFld into cursor curAll nofilter

select * from curAll where  TableName = "Copy 2" into cursor curDifference nofilter
Then you can proceed with curDifference and analyze each individual field.
If it's not broken, fix it until it is.


My Blog
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform