Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
What is faster: insert from memvar or insert fields?
Message
From
24/07/2006 20:41:50
Dragan Nedeljkovich (Online)
Now officially retired
Zrenjanin, Serbia
 
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Environment versions
Visual FoxPro:
VFP 9 SP1
OS:
Windows XP
Database:
Visual FoxPro
Miscellaneous
Thread ID:
01139366
Message ID:
01139529
Views:
12
>Hi everybody,
>
>I'm wondering what is better and faster:
>
>select Table1
>scatter memvar
>FieldFK = something
>PointerField = something
>release cEntered_User, tEntered_Date
>insert into Table2 from memvar
I've had a few pieces of code where I (the framework I inherited, actually) used scatter/gather memvar a lot. The trouble with that approach is when you don't do all the fields, and there's a variable (from previously executed code) whose name matches a field. It will be GATHERed (or inserted) and you wouldn't notice. The reliability of this approach decreases exponentially with the number of lines between Scatter and Gather/Insert :).

It gets even worse if you're inserting into more than one table. You need to control all the variables, and still there's a chance a new field in one of target tables may pop up, with a name same as one of the variables. So some field may get a value you didn't intend to - and catching this type of error is time consuming.

I'm for the insert ... values or insert ... name simply because you have more control over what's being written.

back to same old

the first online autobiography, unfinished by design
What, me reckless? I'm full of recks!
Balkans, eh? Count them.
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform