Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
One SPT cursor to be used in another SPT
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Base de données, Tables, Vues, Index et syntaxe SQL
Versions des environnements
Visual FoxPro:
VFP 8 SP1
Database:
MS SQL Server
Divers
Thread ID:
01135239
Message ID:
01135242
Vues:
19
This message has been marked as the solution to the initial question of the thread.
>Hi Borislav
>
>>>I have 2 SQL SELECT statements, executed one by one. The problem arise when I wanted to use the returned cursor of the first SPT in the second. The backend is SQL server.
>>>
>>>How can I acheive this? Please advise.
>>
>>How to use it?
>>To update something or you want to use it to filtering data?
>
>It is more like further JOINing. I mean the first SPT uses a few backend tables and creates a cursor in VFP. The second one again does a SPT, but this time the just created cursor is JOINed with another backend table to create a second cursor to be used seperately.
>
>Hope this is what you wanted to know.

You can't do that.
SPT cursor (or any other VFP Table/Cursor) is not visible to SQL Server, you can't pass it as Parameter. You could save it to a table and join it with using T-SQL OPENROWSET() function, but this is slooooow :o)
You could do this joing two ways:
1. Use derived table with exact the same SELECT as first SPT cursor:
TEXT TO lcFirstCursorSelect NOSHOW TEXTMERGE
     SELECT ....
            FROM .....
            WHERE ....
ENDTEXT

TEXT TO lcSecondCursorSelect NOSHOW TEXTMERGE
     SELECT ....
            FROM .....
     JOIN (<<lcFirstCursorSelect>>) TblFrst ON .......
     WHERE ....
ENDTEXT
2. Select records w/o joining and than select jojned records using both SPT cursors in VFP.
I personaly prefer first suggestion, because it is faster and you get all records you need directly.
Against Stupidity the Gods themselves Contend in Vain - Johann Christoph Friedrich von Schiller
The only thing normal about database guys is their tables.
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform