Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Swapping Values in Two Columns
Message
De
04/09/2013 10:55:14
 
 
À
04/09/2013 10:33:19
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Versions des environnements
Visual FoxPro:
VFP 9 SP2
OS:
Windows 8
Network:
Windows 2000 Server
Database:
Visual FoxPro
Application:
Desktop
Divers
Thread ID:
01581882
Message ID:
01582088
Vues:
46
>>>>>I'm trying to switch the values from two columns. Here's my code:
>>>>>
>>>>>
update Items;
>>>>>   SET cDesc = cIntDesc ;
>>>>>   , cIntDesc = cDesc
>>>>>
>>>>>This is a VFP database.
>>>>>Shouldn't that work?
>>>>>What is happening is that both columns get the original value that was in cIntDesc.
>>>>
>>>>
>>>>The changes have to occur in some order. You'll have to use a variable to hold one value temporarily.
>>
>>>I understand. I just had a very strong memory of using code like this before. Maybe it was on a SQL Server database which apparently allows you to do this.
>>
>>That is one of the few glitches in vfp SQL that is non-Standard. Discussed that a while back with Aleksey (when vfp still was maintained by MS) and his comment was along the lines "don't hold your breath hoping for this behaviour [in vfp] to change, deep xBase roots showing here".
>
>Thanks Thomas.

Also think of the good part: that way you can exchange replace and update in vfp without checking each "with/=" for such side effects.
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform