Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
INSERT not as maintainable?
Message
 
À
26/07/2006 15:56:08
Mike Yearwood
Toronto, Ontario, Canada
Information générale
Forum:
Visual FoxPro
Catégorie:
Autre
Divers
Thread ID:
01140411
Message ID:
01140574
Vues:
17
If speed is not a concern, I will do it like that:
Scatter Name o
o.Field1=Expression1
o.Field2=Expression2
o.Field3=Expression3
Insert Into xx From Name o
If speed is a concern, I will do it like that:
#Define zFlds Field1     , Field2     , Field3
#Define zVals Expression1, Expression2, Expression3
Insert Into xx (zFlds) Values (zVals)
if there are too many fields, I will do it like that:
#Define zFlds1 Field1     , Field2     , Field3
#Define zVals1 Expression1, Expression2, Expression3
#Define zFlds2 Field4     , Field5     , Field6
#Define zVals2 Expression4, Expression5, Expression6
Insert Into xx (zFlds1,zFlds2) Values (zVals1,zVals2)
Ben


>Is it just me or is
>
>REPLACE ;
> field1 with expression1, ;
> field2 with expression2 ;
> field3 with expression3 ;
> IN alias
>
>You can't get the fields out of synch with the values.
>
>Easier to read/maintain/modify than:
>
>INSERT INTO alias ;
> (field1, ;
> field2, ;
> field3) ;
> VALUES ;
> (expression1, ;
> expression2, ;
> expression3)
>
>If the field list gets out of synch with the values, that's going to be messy. Not only that, but with a longer list of fields, the chances of error goes up.
>
>Besides the advantages of doing the equivalent of an append blank and a replace all at the same time AND SQL compatibility, what other benefits are there to INSERT in VFP?
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform