Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Referencing variable cursor names and their fields
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Base de données, Tables, Vues, Index et syntaxe SQL
Versions des environnements
Visual FoxPro:
VFP 9 SP2
OS:
Windows 7
Network:
Windows 2003 Server
Database:
Visual FoxPro
Divers
Thread ID:
01515685
Message ID:
01515737
Vues:
63
>You do need it according to the original logic. (he was doing seek and replace).

either one works the same for me, so i use the short one, are there any drawbacks of using it my way?
CREATE CURSOR cur (pk int autoinc, xvalue char(10), fkPlans int)
CREATE CURSOR pln (pk int autoinc, xvalue char(10))

INSERT INTO cur (xvalue, fkPlans) VALUES ('', 2)
INSERT INTO cur (xvalue, fkPlans) VALUES ('', 4)
INSERT INTO cur (xvalue, fkPlans) VALUES ('', 6)
INSERT INTO cur (xvalue, fkPlans) VALUES ('', 8)

INSERT INTO pln (xvalue) VALUES ('ONE')
INSERT INTO pln (xvalue) VALUES ('TWO')
INSERT INTO pln (xvalue) VALUES ('THREE')
INSERT INTO pln (xvalue) VALUES ('FOUR')
INSERT INTO pln (xvalue) VALUES ('FIVE')
INSERT INTO pln (xvalue) VALUES ('SIX')
INSERT INTO pln (xvalue) VALUES ('SEVEN')

UPDATE cur SET xvalue = pln.xvalue from pln WHERE pln.pk = cur.fkplans

* or

UPDATE cur SET xvalue = pln.xvalue FROM pln INNER JOIN cur ON cur.fkPlans = pln.pk
"The five senses obstruct or deform the apprehension of reality."
Jorge L. Borges?

"Premature optimization is the root of all evil in programming."
Donald Knuth, repeating C. A. R. Hoare

"To die for a religion is easier than to live it absolutely"
Jorge L. Borges
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform