"CONTAINS" Command Help

jenciso

New Member
I have a table with a string(1000) Field (No Index) I need found a word inside ("NUCLEAR"), I try the next

For each MyTABLE where MyTABLE.Field CONTAINS "Nuclear".
Display MyTABLE.JobNum.
END.

Is not working, do i need to create a index? or what I'm doing wrong.

Thank you for your help.
 

TomBascom

Curmudgeon
To use CONTAINS the field must have a WORD-INDEX.

You could also program:
Code:
for each myTable no-lock where index( myTable.field, "nuclear" ) > 0:
  display myTable.jobNum.
end.

But it will be painfully slow on any non-trivial data set because it is a table-scan; the INDEX() function must be evaluated against every record in the table.
 
Top