Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Update SQL table from VFP table
Message
From
31/08/2015 09:22:51
 
 
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Environment versions
Visual FoxPro:
VFP 9 SP2
OS:
Windows 7
Network:
Windows 2003 Server
Database:
MS SQL Server
Application:
Desktop
Miscellaneous
Thread ID:
01623948
Message ID:
01624012
Views:
63
>>Looking for a little bit of best practices, and a little bit of how to.
>>
>>I need to update a SQL Server table with values from a VFP table.
>>
>>Should I upload the VFP table to a temporary SQL cursor and SQLEXEC the update statement? How would upload the cursor and remove it when done?
>>
>>Or should I download the SQL table to a VFP cursor,run the UPDATE statement in VFP, and post the results back to SQL? How would I post the updates back to SQL?
>>
>>I know how to do this by SCANning the VFP table and updating a single record at a time, but I would prefer to avoid that overhead.
>>
>>Chris.
>
>Hi, Chris, roughly how many rows are in the VFP table? (and could it grown significantly over time). And roughly how many rows in the SQL table?
>
>I can't make an absolute statement, but generally speaking, the last two items you had (download the SQL table to VFP, run the update, and then post back to SQL.....or to scan the VFP table one row at a time) are going to be low on the practical range. If you can upload the VFP table to a SQL Staging table and then perform the UPDATE in SQL, that might be the ticket, depending on how big the VFP table it.
>
>Also - SSIS in SQL Server is often very good for tasks like this.

This is what I get for working on a Friday...

The Fox table is ~700 rows at the moment, a monthly update from outside, so no telling how large or small it might get; the SQL table is several million. I've written a VFP program to handle the file, look up ID#s, post a couple changes. Last in the process, it needs to update the SQL file so another internal app can act upon the changes, and I'd prefer to do it from the VFP program.

I'm not strong with SQL server, but I can open the SQL database, and I have the update statement but it seems to imply both tables in the same format. I don't know how to get the VFP table into SQL temporarily, or write to the SQL table without downloading the whole thing...
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform