lnHandle=SQLStringConnect('DRIVER=SQL Server;SERVER=(local);Trusted_connection=Yes') lcDataSource = _samples + 'data\testdata.dbc' Text to m.lcSQL textmerge noshow SELECT customers.* FROM -- this is MSSQLs own table customers aliased as customers here Northwind.dbo.customers customers inner join -- this is VFP's testdata!customer aliased as vfpCustomer -- we are gonna join with it. -- notice that it's used as if it was a native MSSQL table -- also notice that since we are calling this from MSSQL -- ANSI SQL is in effect. (IOW ANSI is ON) -- therefore we cannot simply say cust_id = 'F' OPENROWSET('VFPOLEDB', '<<m.lcDataSource>>';'';'', 'select * from customer where cust_id like "F%"') vfpCustomer On customers.customerID = vfpCustomer.cust_id EndText SQLExec(m.lnHandle, m.lcSQL,'myVFPData') SQLDisconnect(m.lnHandle) * Check results Select myVFPData BrowseCetin