Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
GATHER NAME vs APPEND
Message
De
18/06/2004 05:46:00
 
 
À
17/06/2004 16:05:14
Mike Yearwood
Toronto, Ontario, Canada
Information générale
Forum:
Visual FoxPro
Catégorie:
Autre
Divers
Thread ID:
00914780
Message ID:
00914947
Vues:
27

Hi all

I've run an SQL command. I want to add those records to a table. I use APPEND FROM. If there is a field in the SQL result that has a value bigger than the corresponding field in the table, I don't get an error message. The value of that field will be *.**.

If on the other hand, I want to update existing records from the SQL result, I could do this...

SELECT c_Result
SCAN
SCATTER NAME loScatter
SELECT TheTable
GATHER NAME loScatter
ENDSCAN

The bigger SQL field will generate a Numeric overflow error. Why does it not just behave like the append?

The error message does not say which property or field has the problem. I believe Visual FoxPro should name the first field with a problem.


With SCATTER MEMVAR or ARRAY ?


One other thing. SQL Server 7 allows for this...

UPDATE TheTable SET ;
Field1 = c_Result.Field1 ;
FROM TheTable, c_Result ;
WHERE TheTable.PK = c_Result.PK

Is there a way to use VFP's UPDATE - SQL to update all TheTable records from c_Result?

Thanks!


On VFP9 allow above syntax.

On previous releases, you can use this:
* comment
* - a VFP bug force a EVAL parser workaround
* - this work with and without index very well
* - if you known that a index exist then you can use a SEEK()

CREATE CURSOR c_Result (PK I,Field1 I)
INSERT INTO c_Result VALUES (1,1)
INSERT INTO c_Result VALUES (2,2)

CREATE CURSOR TheTable (PK I,Field1 I)
INSERT INTO TheTable VALUES (1,0)
INSERT INTO TheTable VALUES (2,0)

USE DBF('c_Result') AGAIN IN 0 ALIAS _c_Result && ORDER PKEY if a PK index exist
UPDATE TheTable SET ;
Field1 = _c_Result.Field1 ;
WHERE PK=EVAL("LOOKUP(_c_Result.PK,PK,_c_Result.PK)") AND !EOF('_c_Result')
USE IN _c_Result
* with the INDEX
*WHERE SEEK(PK,'_c_Result')
SELECT TheTable 
BROWSE
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform