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:
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
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
SELECT TheTable
BROWSE