Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Combine 2 or more cursors
Message
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Miscellaneous
Thread ID:
00568592
Message ID:
00568701
Views:
18
Hi Sergey,

The difference is that each cursor came from a different table, you referred
in each Select into the same table which was Table1. That was not my
case. Maybe when you meant Table1 in the second SQL and it was a typo,
I was not sure. That was enough for me to get the idea.

The idea behind all of that manipulation is to find a way to bypass the 8192 characters max problem for each Select statement, by breaking 1 big SQL into small SQLs and re-merge them.

Regards,

Doron

>It'll work as long as cursors temp1 and temp2 have the same number of records >and don't have deleted records.
>BTW, I don't see what's the difference between your and my code besides >cursors names.


>
>>Hi Sergey,
>>
>>Looking at your idea I created the following and it seems
>>to work for now. I need to test it for other situations and see.
>>
>>SELECT aaa, bbb, RECNO() as rn ;
>> FROM temp1 ;
>>INTO CURSOR xxx1
>>
>>SELECT ccc,ddd, RECNO() as rn ;
>> FROM temp2 ;
>>INTO CURSOR xxx2
>>
>>SELECT ;
>> xxx1.aaa ,;
>> xxx1.bbb ,;
>> xxx2.ccc ,;
>> xxx2.ddd ;
>>FROM ;
>> xxx1 ;
>>INNER JOIN XXX2 ;
>> ON xxx1.rn==xxx2.rn ;
>>INTO CURSOR ResultCursor
>>
>>Thanks,
>>
>>Doron
>>
>>>>
>>>>I have 2 Cursors:
>>>>Cursor A: aaa bbb ccc
>>>>Cursor B: ddd eee fff
>>>>
>>>>I want to combine the two cursors into 1 cursor:
>>>>Cusror C: aaa bbb ccc ddd eee fff <--- This is one new record
>>>>
>>>>I don't have an id per each cursor since cusor A or cursor B could be
>>>>a JOIN of other tables as well.
>>>>
>>>>I could create an id per each cursor but that may take time if I have
>>>>200,000 records per each cusror. Also I can not do an sql on the RECNO()
>>>>of each cursor(that could be good). Each cursor has same amount of records.
>>>>
>>>>Any ideas are appreciated.
>>>>
>>>>Regards,
>>>>
>>>>Doron
>>>You can do it using just select statements
>>>SELECT aaa, bbb, ccc, RECNO() as rn ;
>>>  FROM table1 ;
>>>  INTO CURSOR temp1
>>>
>>>SELECT ddd, eee, fff, RECNO() as rn ;
>>>  FROM table1 ;
>>>  INTO CURSOR temp2
>>>
>>>SELECT aaa, bbb, ccc, ddd, eee, fff  ;
>>>  FROM table1 Join ON temp1.rn = temp2.rn ;
>>>  INTO CURSOR ResultCursor
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform