Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Bulk update of SQL Server Table?
Message
From
13/08/2003 12:32:11
Cetin Basoz
Engineerica Inc.
Izmir, Turkey
 
General information
Forum:
Visual FoxPro
Category:
Client/server
Miscellaneous
Thread ID:
00819739
Message ID:
00819835
Views:
10
>After updating a large temporary DBF with data, what is the fastest way of updating the corresponding SQL Server table without having to SCAN through the DBF and issuing individual UPDATE commands.
>Note: I have matching Primary keys on the DBF and SQL Server tables.

Russel,
You updated the SPT cursor you got from SQL server, right ? If so set that cursor as updatable and tableupdate. ie:
lnHandle=Sqlstringconnect(;
 'DRIVER=SQL Server;SERVER=servername;Database=Pubs;Trusted_Connection=Yes')
SQLExec(lnHandle,'select * from dbo.authors','v_authors')
CursorSetProp('KeyFieldList','au_id','v_authors')
CursorSetProp('WhereType',1,'v_authors')
CursorSetProp('Tables','authors','v_authors')

CursorSetProp("UpdateNameList", ;
  "au_id    authors.au_id,"+;
  "au_lname authors.au_lname,"+;
  "au_fname authors.au_fname,"+;
  "contract authors.contract",'V_authors')

CursorSetProp('UpdatableFieldList','au_fname,au_lname,contract','v_authors')
CursorSetProp('SendUpdates',.T.,'v_authors')
CursorSetProp('Buffering',5,'v_authors')

* Update the data in browse
Browse title 'Modify data'

* Submit
Tableupdate(2,.T.,'v_authors')
SQLExec(lnHandle,'select * from dbo.authors','afterupdate')
SQLDisconnect(lnHandle)
Select afterupdate
Browse
Cetin
Çetin Basöz

The way to Go
Flutter - For mobile, web and desktop.
World's most advanced open source relational database.
.Net for foxheads - Blog (main)
FoxSharp - Blog (mirror)
Welcome to FoxyClasses

LinqPad - C#,VB,F#,SQL,eSQL ... scratchpad
Previous
Reply
Map
View

Click here to load this message in the networking platform