Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Local table used in remote queries?
Message
 
To
20/02/2004 13:42:58
Mike Yearwood
Toronto, Ontario, Canada
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Miscellaneous
Thread ID:
00879382
Message ID:
00879438
Views:
15
Here's something I did for an app a while back... it actually does more than this, but this gives a good example.

Prob: We had vfp and sql server - and needed to join and bring back the children from sql.

I used XML to do it;

in vfp, I created an xml string of the keys I needed to get that ended up looking like this;
'<ROOT><B K=''1''></B><B K=''2''></B></ROOT>'
I called a stored procedure in SQL from vfp that looked like this;
CREATE PROCEDURE [dbo].[afi_getdatadynamic]
 @doc varchar(8000)
 AS

DECLARE @idoc int


--Create an internal representation of the XML document.
EXEC sp_xml_preparedocument @idoc OUTPUT, @doc
-- Execute a SELECT statement that uses the OPENXML rowset provider.
SELECT    *
FROM OPENXML (@idoc,'/ROOT/B',1) WITH (K int) AS JT 
 ,tbllistcustomer WHERE tbllistcustomer.ipkey = JT.K
GO
call from vfp
sqlexec(lnhandle,"exec afi_getdatadynamic '<ROOT><B K=''1''></B><B K=''2''></B></ROOT>'","_upd")
The actual implementation has the ability to send the select as well and execute it dynamically. But if you only need a particular output, this might work.

>Hi all
>
>I have a situation. I have a table of IDs on a local drive. I want SQL Server to return records matching those IDs. There are possibly too many for them to be concatenated into a string. Can I have SQL create a table for a particular user, append these records, use that table in one or more other SPTs and drop that table when I'm done?
>
>If so, can you provide a small example?
Wayne Myers, MCSD
Senior Consultant
Forte' Incorporated
"The only things you can take to heaven are those which you give away" Author Unknown
Previous
Reply
Map
View

Click here to load this message in the networking platform