First of all you first select cannot work:
rc=sqlexec(nHandleTMD, "select * from DEDUP where SESSION_ID = '" + sSession_ID + "' ORDER BY MAILING_DPBC, MAILING_ADDR_LINE1 into sqlResult")
It should probably be:
rc=sqlexec(nHandleTMD, "select * from DEDUP where SESSION_ID = '" + sSession_ID + "' ORDER BY MAILING_DPBC, MAILING_ADDR_LINE1", "sqlResult")
OR it could be:
rc=sqlexec(nHandleTMD, "select * into sqlResult from DEDUP where SESSION_ID = '" + sSession_ID + "' ORDER BY MAILING_DPBC, MAILING_ADDR_LINE1")
The rest needs some explanations because it seems you are trying to insert previously selected records to the same table with diffrent SESSION_ID and TABLE_NAME . Am I right? Please correct me.
So, if you really need it then you may create the temporary table on the server. Suppose "sSession_ID", "strSession_ID", and "strTable" are memory variables. The ORDER BY part of the select is not necessary, it does not ensure the right row order in the target table and it just slows down the SELECT. Of course, you may use it.
Main Topics
Browse All Topics





by: Olaf_DoschkePosted on 2009-04-30 at 00:10:56ID: 24267555
Well, you can't access VFP cursors from within SQL Server. SQLEXEC just sends the SQL string to SQL Server, you can embed parameters with ?varname and SQLExec also sends variable values in these places, but you can't send a VFP cursor, not even with ?aliasname.
There are ways to make an SPT result cursor updatable, you need to adress and set several properties of the cursor via SQLSetprop(). The much easier way is to use the Cursoradapter class of VFP, which generates such updatable Cursors with much more ease. The native Builder for the cursoradapter is ratherhelpful for that.
You can then do any changes in the cursor and simply commit them to SQL by a normal Tableupdate(), as you would do with local or remote view.
Bye, Olaf.