Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
IIF syntax
Message
De
14/09/2015 16:42:12
Lutz Scheffler
Lutz Scheffler Software Ingenieurbüro
Dresden, Allemagne
 
 
À
14/09/2015 15:11:10
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Titre:
Versions des environnements
Visual FoxPro:
VFP 9 SP2
OS:
Windows Server 2012
Network:
Windows 2008 Server
Database:
MS SQL Server
Application:
Web
Divers
Thread ID:
01624559
Message ID:
01624601
Vues:
57
>>>The fastest and most correct way is
>>>
>>>
replace myval with int(myval) for myval < 7  in alias
>>>
>>>The only time myval needs an alias is when you're replacing across multiple aliases joined with set relation - a technique that should be avoided.
>>
>>But this would change all records in myval<7. Might not be intended.
>
>Yes, that's a gotcha in the VFP help file. The help file says "The default scope for REPLACE is the current record (NEXT 1)." It doesn't mention that if you include a FOR clause, the scope defaults to ALL.
>
>CREATE CURSOR Test ( iInt I )
>INSERT INTO Test ( iInt ) VALUES ( 1 )
>INSERT INTO Test ( iInt ) VALUES ( 2 )
>GO TOP IN Test
>REPLACE iInt WITH 5 FOR iInt < 3 IN Test && 2 replacements
>
See message#1624599 :)

BTW: GO TOP is superfuous. ALL and implicit ALL in FOR will do anyway.


Words are given to man to enable him to conceal his true feelings.
Charles Maurice de Talleyrand-Périgord

Weeks of programming can save you hours of planning.

Off

There is no place like [::1]
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform