IF EXISTS (SELECT name FROM sysobjects WHERE name = N'usp_OrdersByList' AND type = 'P') DROP PROCEDURE usp_OrdersByList GO CREATE PROCEDURE usp_OrdersByList @XmlList varchar(4000) = 0 AS DECLARE @hDoc int EXECUTE sp_xml_preparedocument @hDoc OUTPUT, @XmlList SELECT * FROM orders ord JOIN OPENXML(@hDoc, 'VFPData/crslist') WITH (customer_id char(6) ) lst ON ord.CustomerId = lst.customer_id EXECUTE sp_xml_removedocument @hDocNow, run following code from VFP. Don't forget to put your server name and login info.
OPEN DATABASE (HOME(2) + "\tastrade\data\tastrade") lcXml = "" SELECT TOP 10 customer_id ; ORDER BY 1 ; FROM customer ; INTO CURSOR crsList ? CURSORTOXML("crsList", "lcXml", 2) lcDB = "NorthWind" lcServer = "..." lcConnStr = "DRIVER=SQL Server;" + ; "UID=Administrator;" + ; "Trusted_Connection=Yes;" + ; "SERVER=" + lcServer + ";" + ; "DATABASE=" + lcDB lnConn = SqlStringConnect(lcConnStr) IF lnConn < 0 *? _processodbcerror() RETURN ENDIF lnResult = SQLEXEC(lnConn, "EXEC usp_OrdersByList ?lcXml", "cesOrderList") IF lnResult < 0 *? _processodbcerror() RETURN ENDIF Sqldisconnect(0) BROWSE NOWAIT>Sorry it took so long to reply but I have done some testing and have came to a few conclusions. One is that I have found really no speed difference between sending and entire sql string (one number at a time) and then appending the result into a cursor in VFP as apposed to sending a function call or proc call (one number at a time) and appending that result into a vfp cursor. Second, in order to send a really long list I need to use XML (I think). However, I am not sure how to handle the XML. I created a cursor of member numbers and ran the cursortoxml() and it created an xml file. What it does not look like is the example that you pointed me to. So, that raised more questions.