The task is, I need to export some tables of a Visual Foxpro database to Sql Server Database. I could establish a connection between VFP and SQL Server through SQLConnect(). Even, SQLEXEC is also executable without any errors.

All I need to execute is a command like "Select * into {table_name} from {Source_table_name}"

{Table_name} is the new table that will be created in Sql Server Database

{Source_table_name} would be a table from VFP database (.DBC)

All this should be possible being in VFP. I have tried Import from SQL Server and it is working fine, but I need to perform this task being in VFP environment.

Please suggest any methods/code.