Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
How to count only new rows
Message
From
15/10/2004 16:15:25
 
 
To
15/10/2004 14:07:31
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00951802
Message ID:
00951843
Views:
5
Why not use SQL
SELECT DISTINCT empno ;
      FROM  currentTable.dbf INTO CURSOR cNewRecords2Add ;
      WHERE empno NOT IN (SELECT empno from NewTable.dbf) NOFILTER
select NewTable
append from (dbf("cNewRecords2Add"))
>Hello,
>
>currentTable.dbf with 4 records(rows)
>
>empno field:
>
>11111
>22222
>33333
>44444
>
>
>NewTable.dbf with 2 records(rows)
>
>empno field:
>
>22222
>44444
>
>NewTable never accepted duplicated empno numbers while inserting new values due to the
>the data integrity checked inside.
>
>I want to count 2 new records such 11111 and 33333 into lnRectot=2 not 4 because
>22222 and 44444 already in Newtable.dbf
>
>How can I get my lnRectot = 2 with below codes ?
>
>Tia
>
>
>lnconnect = SQLSTRINGCONNECT("dsn=sql server; uid=uid; pwd=pwd")
>
>IF lnConnect > 0
>
>   SELECT currentTable
>   go top
>
>   SCAN
>
>      lcstring = "INSERT INTO newTable (empno) Values (currentTable.empno)
>
>      lnExec = sqlexec(lnconnect,lcstring)
>
>      IF lnExec < 0
>         && did not succeed
>         =AERROR(laerror)
>      ENDIF
>
>   ENDSCAN
>ELSE
>	=AERROR(laerror)
>	FOR N = 1 TO 7  && display all elements of the array
>		? laerror(N)
>	ENDFOR
>	RETURN
>ENDIF
>=sqldisconnect(lnconnect)
>
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform