>Hi !!
>
>I would like to use my free tables in the SQL for fetching the details with the help of SQL command - OPENROWSET(). The problem is, this command is working thru the SQL Query Analyzer but not working thru VFP. Pls guide me, how can I execute the same thru VFP ?
>
>Thanks in advance
>Ravi Mehrotra
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)
Select myVFPData
Browse
Cetin