Article ID: 193079
Article Last Modified on 8/12/1999
SELECT *, .t. FROM temp_table ;
WHERE temp_table.cUsageTL = EVALUATE(STRTRAN("lcService" ;
+ (" 91")," ","")) ;
INTO CURSOR Temp4
CLOSE DATABASES ALL
SET SAFETY OFF
* Create table and index.
CREATE table temp_table (cBTN c(2), cUsageTl c(10))
INDEX on cUsageTl tag cUsageTl
SET SAFETY ON
* Insert some records.
FOR lnj = 1 to 10
INSERT into temp_table (cBTN, cUsageTl) values ("91", "Sp800/W")
INSERT into temp_table (cBTN, cUsageTl) values ("91", "Sp800/X")
INSERT into temp_table (cBTN, cUsageTl) values ("91", "Sp800/Y")
ENDFOR
* Initialize variables to Evaluate.
lcService91="Sp800/W"
lcService92="Sp800/X"
lcService93="Sp800/Y"
* Issue SELECT with trailing, no and leading space.
SELECT *, .t. FROM temp_table WHERE temp_table.cUsageTl = ;
EVALUATE("lcService"+ALLTRIM("91 ")) ;
INTO CURSOR Temp2
SELECT *, .t. FROM temp_table WHERE temp_table.cUsageTl = ;
EVALUATE("lcService"+ALLTRIM("92")) ;
INTO CURSOR Temp3
* It fails with the leading space.
SELECT *, .t. FROM temp_table WHERE temp_table.cUsageTl = ;
EVALUATE("lcService"+ALLTRIM(" 93")) ;
INTO CURSOR Temp4
SELECT *, .t. FROM temp_table ;
WHERE temp_table.cUsageTL = EVALUATE(STRTRAN("lcService" ;
+ (" 91")," ","")) ;
INTO CURSOR Temp4
RESULTS: After running the program, no error occurs, and the STRTRAN()
function trims the leading space.
Additional query words: kbVFp500abug kbVFp600fix kbSQL
Keywords: kbbug kbfix kbcode KB193079