Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

delete VFP table from sql server 2000

Status
Not open for further replies.

carloshgo

Programmer
Jul 16, 2007
1
US
Hello!

I'm Creating a DTS to export information into a VFP table but first a need to
delete all existing data from VFP table

I'm using a conecction "Microsoft OLE DB Provider for Visual Fox Pro" between
SQL server 2000 and my VFP free table called "ValidStores.dbf" and i can view
data from VFP table and export data from SQL 2000 to VFP table.

i added a SQL server task object to execute the command to delete the table
but i has been unsucessfull, im have using the following comand lines
delete from ValidStores <-------- does not do anything to the VFP table but
step run sucessfully
ZAP <--------- sents an error message with a none valid command

How could i delete the data inside the table since i dont want to delete the
table because already have a index.

or is there a better way to doit?

Thanks.
 
You can use execscript() via OLE DB, which enables you to use some commands, that are not supported directly. Execscript executes a whole script of commands. In this case you'd need to open the table exclusive, then ZAP and finally close it again.

Code:
Try
  Use ValidStores In 0 Exclusive
  Zap In ValidStores
  * empty table
Catch
  Use ValidStores In 0 Shared
  Delete From ValidStores
  * at least records are marked deleted, better than doing nothing
Finally
  Use In Select("ValidStores")
EndTry

This code (including line feeds) you'll need in a var lcCode and execute it via Execscript(lcCode). Give it a try.

Bye, Olaf.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top