Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
New FAQ - Merge data
Message
From
24/07/2007 18:17:24
Mike Yearwood
Toronto, Ontario, Canada
 
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
01243120
Message ID:
01243324
Views:
28
>>>>Hey all
>>>>
>>>>Check out FAQ#33156
>>>
>>>Mike,
>>>
>>>1). I would assume that you first want to update records and then insert new records (less records to process - quicker the process)?
>>
>>Yes, I started with that as the title of the FAQ. :)
>>
>
>It was not obvious to me since in the FAQ you first start with INSERT command. I would move insert after UPDATE.
>
>>>2) With lots of fields to be changed and unknown frequency of the changes would you have to list all the fields in OR condition?
>>
>>I always list all the fields. Some people seem afraid to type?!?! :) For them build the field list as a string.
>>
>>> Perhaps it's better to update only particular field's changes rather than all field changes even if the field was not changed?
>>
>>No. One replace command with 10 fields beats 10 replace commands each with 1 field. VFP does not just send the 10 bytes that changed in the record. Although you can tell SQL Server to just update one field, but you need to send more than just the data along the wire to do that.
>>
>
>That's not the point I was trying to make.
>
>I haven't tried, of course, and perhaps it's more costly to first try to find which fields were really changed and then apply changes to only these fields rather than try to change all the fields in one update command.
>
>The first approach would require scan loop for the records to update and use something to determine which fields were changed, etc. Sounds not work the trouble.
>
>
>>> What if the field has some field validation rules?
>>
>>I haven't tried it, but I think one could get the field validation rule via DBGetProp and add it to the OR conditions. Then you'd need a way to log the failures and report them.
>
>Here also was my point about updating all fields. If you do
>replace field with currentfieldval, you're still executing validation rule. So, it would be executed on each record on each field that has the rule. Something to be aware of.

Only on those fields that are different.
if (s.field1 # t.field1 and eval(fieldrule))
If the fields are the same, the field rule doesn't fire.
Previous
Reply
Map
View

Click here to load this message in the networking platform