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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Change part of a value

Status
Not open for further replies.

WelshyWizard

IS-IT--Management
Apr 23, 2006
89
GB
Hi all,

I have a table which contains a column full of values like 959001001
959002001 etc...

I would like to replace 959 with 958.

Does anyone know how to do this?

Cheers

Today is the tomorrow you worried about yesterday - and all is well.....
 
Text field?

Scan the table with a tcursor, and replace.
Code:
tc.open(":alias:tablename.db")
tc.edit()
scan tc :
  ; # of chars don't matter, Paradox uses up to that #
  tc."fieldname"="958"+tc."fieldname".substr(4,20)

  try
    tc.unlockrecord()
  onfail
    ; PLEASE do error checking here!
    errorclear()
  endTry
endscan
tc.endedit()
tc.close()

Tony McGuire
"It's not about having enough time; we have the rest of our lives. It's about priorities.
 
A warning: don't try the scan if the field you are working to convert is a sort field. ie., primary key or secondary key and the table (tcursor) is switchindexed to that secondary index.



Tony McGuire
"It's not about having enough time; we have the rest of our lives. It's about priorities.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top