I would suggest you first try it with DTS, then save the DTS. This will give you some SQL which you can then copy into your Visual FoxPro application, and then execute from there. I very rarely use Visual FoxPro, but that is how I would approach the problem with Delphi.