insert into mySQLTable (myField1, myField2, myField...) select myVFPField1, myVFPField2, ... from OpenQuery(myVFPServer, 'my query here')ie: (assuming what is retrieved matches mySQLTable field names and order)
insert into mySQLTable select * from openquery(myvfpserver, 'Select c.cust_id, c.company, o.order_id, cast(EVL(o.order_date,null) as date) as orderDate, cast(evl(o.shipped_on,null) as date) as shipped_on, e.First_Name-(" "+e.Last_Name) As Employee, cast(evl(e.birth_date,null) as date) as birth_date, oi.line_no, p.prod_name, oi.unit_price, oi.quantity FROM ("C:\PROGRAM FILES\MICROSOFT VISUAL FOXPRO 9\SAMPLES\data\customer") c INNER Join ("C:\PROGRAM FILES\MICROSOFT VISUAL FOXPRO 9\SAMPLES\data\orders") o ON c.cust_id = o.cust_id INNER Join ("C:\PROGRAM FILES\MICROSOFT VISUAL FOXPRO 9\SAMPLES\data\Employee") e ON o.emp_id = e.emp_id INNER Join ("C:\PROGRAM FILES\MICROSOFT VISUAL FOXPRO 9\SAMPLES\data\orditems") oi ON o.order_id = oi.order_id INNER Join ("C:\PROGRAM FILES\MICROSOFT VISUAL FOXPRO 9\SAMPLES\data\products") p ON oi.product_id = p.product_id order By p.prod_name')For creating whole syntax I, of course use some VFP code to write it for me, rather than typing N fields:) Then directly from VFP I can run this via SPT or use M.Studio new query window or save as .sql to run later. Writing whole 'create database', 'create table' ... 'insert ...' series I find it easy to do with VFP's textmerge capabilities. I hope you still have VFP installed to do this job. Alternatively you could use SqlBulkCopy class from a .Net code (however I found doing that from VFP as the easiest).