REPLACE ALL Desc2 WITH IIF(LEFT(Code,3)=="AAA", "GOOD","BAD")But If You have more CODEs and want to replace all Codes with LEN bigger then 3 with the value of the Main record (that with LEN = 3)
SELECT * FROM MyTable WHERE LEN(ALLTRIM(Code)) == 3 INTO CURSOR cTemp SELECT cTemp INDEX ON LEFT(Code,3) TAG cTemp SELECT MyTable SET REATION TO LEFT(Code,3) INTO cTemp REPLACE ALL Desc2 WITH cTemp.Dec1 USE IN cTemp