main logo
Subject: RE: [VAPP/AS] quickest way to empty a table and reload
Author: Lloyd Butler
Posted: 2001/03/30 11:05:26
 
View Entire Thread
New Search


>>>> tell cursor>> delete every record>> end tell>>yes>>> I think you also should have an 'update' in there as well so that the>> change to the cursor gets back into the base object.>>no LLoyd.>>> With the update in there, it works like a charm. Now I ju
st need to>find > those extra hours in the day to get to work more on this instead>of >just a > minute here and a minute there.>>Hmm. what you mean by update ?>Example of code ?>>I am sure you must not use update because you do multi-record operation.
We are both correct. It works with or without the update in there. I
figured since I was making a change to the Cursor, I had better do the
update to get it to refresh the base object.

Here is the sample code

-- let's build the sql statements to get a full and empty
cursor
set theCommand to "select * from table" set theCommand2 to "select * from table where RecID='0'" -- let's build the cursor's
tell theDB set theCursor to SQL Select theCommand set theCursor2 to SQL Select theCommand2 end tell -- let's load up the empty cursor
tell theCursor2 import from ascii file theFile end tell
-- let's empty the full cursor tell theCursor delete every record update -- This one is really not needed, but does not seem
-- too cause problems end tell
-- let's update the freshly loaded ccursor and the database tell theCursor2 update end tell
-- we now have a refreshed database, and the switch was quite fast,
at least for small test tables .

For larger tables (read lots of columns), would it be a good idea to turn
off indexing before importing and back on once the new data is in there, or
will that make a difference?


Lloyd Butler
Product and Systems Development Supervisor
TWN Commercial Services
lbutler AT on .DOT pelmorex.com
P: (905) 566-9511 ext 286
F: (905) 566-9370
 
©2001 Lloyd Butler
<-- Prior Message New Search Next Message -->