Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Update records in a table
Message
From
06/08/2002 17:27:45
Hilmar Zonneveld
Independent Consultant
Cochabamba, Bolivia
 
 
To
06/08/2002 17:23:59
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Miscellaneous
Thread ID:
00686781
Message ID:
00686785
Views:
37
>Hi,
>
>I have two databases, they are basically the same dbase1 is the
>original one, and dbase2 in the new one. What I'm trying to do
>is replace the contents of a table in dbase1 with the contents of a
>table in dbase2. Dbase2 has the latest data in it.
>
>To expand on this. Both of the tables are called "advisory", the
>client may have made some changes to a couple of records in this table
>within dbase1. So when I update the contents I only wish to change
>records which the client has not changed. Any record that has changed
>has a flag set to .T.
>
>So what I have done is:
> CLOSE DATABASES
> CLEAR
> OPEN DATABASE "c:\sas update\gen001\sas.dbc"
> USE advisory EXCL
> DELETE FROM advisory WHERE recchanged =.F.
> PACK
>
>
>This then leaves only the records which have changed. I now want to
>add all other records from the new table in dbase2. I am not sure if
>the best way is to use an APPEND FROM or a REPLACE, or is there a
>better way.
>
>The Key to both tables is the mangercode.
>
>The table will have approximatly 70,000 records so I can't use an ARRAY.
>
>
>Any advice / help would be much appreciated.
>
>Cheers
>Rob

What is "best" - least code, or fastest to execute? Often you want a sort of compromise.

Anyway, another option is to copy the records you want to transfer into a temporary table or cursor.

Try some speed tests before you decide on which is the best approach for your purposes.

HTH, Hilmar.
Difference in opinions hath cost many millions of lives: for instance, whether flesh be bread, or bread be flesh; whether whistling be a vice or a virtue; whether it be better to kiss a post, or throw it into the fire... (from Gulliver's Travels)
Previous
Reply
Map
View

Click here to load this message in the networking platform