Peter77 Posted December 16, 2011 Share Posted December 16, 2011 I'm begging here. Below is a Visual Fox Pro script (just part of it actually). Anyway, I can't for the life of me figure out to get this to work in MySql. This would be run daily against a 100K+ records. The part of it that is tricky (for me) is setting the variable value, since the record order is critical to the script (the data is imported daily from another ancient program). I tried setting the variable within an UPDATE query, but I can't get it to work. I assume that this should be in a procedure? Can some MySQL luminary give this a stab? PUBLIC m.bldtype,cpart m.bldtype='BLD' cpart=ALLTRIM(PART) GO TOP DO WHILE !EOF() IF cpart<>PART cpart=PART m.bldtype='BLD' ENDIF IF bnote='***********' AND SUBSTR(bpart,1,3)='EAR' AND m.bldtype<>'EAR' m.bldtype='EAR' ENDIF IF bnote='***********' AND SUBSTR(bpart,1,3)='KIT' AND m.bldtype<>'KIT' m.bldtype='KIT' ENDIF IF bnote='***********' AND m.bldtype='KIT' AND EMPTY(bpart) AND m.bldtype<>'MISC' m.bldtype='' ENDif DO CASE CASE m.bldtype='BLD' REPLACE bldtype WITH 'BLD' CASE m.bldtype='EAR' REPLACE bldtype WITH 'EAR' CASE m.bldtype='KIT' REPLACE bldtype WITH 'KIT' ENDCASE SKIP ENDDO Link to comment Share on other sites More sharing options...
Recommended Posts