Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
MSDE/SQL Server/etc - Stored procedures and such
Message
 
 
To
16/08/2003 12:34:02
General information
Forum:
Visual FoxPro
Category:
Client/server
Miscellaneous
Thread ID:
00820729
Message ID:
00820787
Views:
24
Hi Jim,

Here's a sample in VFP and T_SQL that should help you.
* VFP
SELECT ... FROM table1 WHERE ... INTO CURCOR temp1
SELECT ... FROM temp1 WHERE ... INTO CURCOR crsResult
*T-SQL
SELECT ... FROM 
    ( SELECT ... FROM table1 WHERE ... ) temp1
 WHERE ... 
As you can see in T-SQL first select is embedded onto the second one and became 'derived table'. Keep in mind the 'cursor' in T-SQL has totally different meanning than in VFP. T-SQL cursors are used to do processing recvord by record, not to store interrmidite data.

>>Jim,
>>
>>PMFJI, Sql Server allows to use result set returned by one query (called derived table) as a source of another. You could redisign your sequence of 3-8 queries into one using derived tables and joins. Even using sproc's you should do that to make queries more effficient.
>
>I understand that SQL Server allows that, but what I'm missing (I think) is... from one SELECT to the next, how does SQL Server know to keep the prior results around for later use IF I have sent the SELECTs each independently to it (as looks like would be the case with my present code)?
>
>I believe that I can do this in a SP (reun them all as a single unit) but want to learn if it's possible without SPs.
>
>Thanks
--sb--
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform