View Single Post
  #9 (permalink)  
Old 02-27-04, 04:25
dmacd dmacd is offline
Registered User
 
Join Date: Feb 2004
Posts: 8
Re: Simple Update Quert

This works great on a test subset of 100 records, however when I try on my database of 6000 records it seems to disappear up its on behind - how can I improve efficiency?

Any ideas!

Thanks again for all advice received!

Quote:
Originally posted by Yuri Korin
Here's an alternative that may do it rather simply:
1. Make a backup of your table!
2. I have assumed that all names entered into the current Surname field have been entered with a consistant format i.e. Forename then a space then the Surname.
3. Run the following script, replacing YourTable with the name of your table:

var
tcPersons tCursor
CurrSurname String
foreEnd smallint ; this holds the position of the space between
; the Forename and the Surname
srnmLong smallint
RecCount longint
endvar

tcPersons.open("YourTable.db")
tcPersons.edit()
tcPersons.home()
RecCount = 0
scan tcPersons:
CurrSurname = tcPersons.Surname
foreEnd = CurrSurname.search(" ") ; find position of the space between names
tcPersons.Forename = substr(CurrSurname,1,foreEnd-1)
srnmLong = CurrSurname.size() - foreEnd
tcPersons.Surname = substr(CurrSurname,foreEnd+1,srnmLong)
RecCount = RecCount + 1
endScan
tcPersons.endEdit()
tcPersons.close()
msgInfo("Records processed","The number of records processed was "+string(RecCount)+".")

Good luck
Reply With Quote