Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Joining a Fox Cursor with a SQL-Server SQL Passthru
Message
General information
Forum:
Visual FoxPro
Category:
Client/server
Miscellaneous
Thread ID:
00458614
Message ID:
00458731
Views:
19
>If you have a cursor in Foxpro, can you do SQL Passthru that is joined to it? And if so, how? I cannot find it in help or any books.
>
>Say the cursor name is cEMPLOYEES.
>If everything was in Fox, my select statement might be:
>SELECT INDIVIDUAL.NAME, cEMPLOYEES.EMPNO ;
> FROM INDIVIDUAL INNER JOIN cEMPLOYEES ON INDIVIDUAL.INDNO == cEMPLOYEES.INDNO
>
>However, if the INDIVIDUAL table was in SQL Server and I wanted to only pull the individuals who's IndNo exists in the cEmployee cursor using SQL Passthru, how would I do that?

You can use a distrubuted join in SQL Server 7/2000. Here is an example using a DSN-less connection string to connect to a VFP datasource:
select * from  openrowset('MSDASQL',
   'Driver={Microsoft Visual FoxPro Driver};SourceType=DBC;SourceDB=C:\MyDir\test.dbc;Exclusive=No;Deleted=No;BackgroundFetch=No',
   'select * from test') as vfp, MyDatabase.dbo.MyTable mt where vfp.field1 = mt.Field1
I just started using this technique so I don't have any performance benchmarks.

I was passing an extremely long (varchar(8000)) parameter string and parsing it with T-SQL to create a temporary table to join against. This introduced a 1600 key limit (length of integer keys transformed in character and separated by a comma). While this wasn't a realistic limitation in the present system, it will be by this time next year.
Larry Miller
MCSD
LWMiller3@verizon.net

Accumulate learning by study, understand what you learn by questioning. -- Mingjiao
Previous
Reply
Map
View

Click here to load this message in the networking platform