if file('master.csv') new file().delete('master.csv') endif if file('tmaster.dbf') drop table tmaster endif select cast(0 as int) as id,part_no,title,qty,cast(sell as int),; grade,mfg,cuml,sdate, cast(asell as int),au_desc from master ; where asell <> 0 and title is not null and part_no < 'AF00760X' ; order by part_no save to tmaster use tmaster scan replace part_no with escape_quote(part_no) replace au_desc with escape_quote(au_desc) //add any other character fields here if necessary replace id with recno() endscan go bottom msgbox( "Count is " +id+ ". The master.csv file must be ftped to the correct directory before importing into mysql." ) copy to master.csv delim use cFileIn ='master.csv' cFileOut = 'tempworkfile.txt' fIn = new file() fIn.open(cFileIn) fOut = new file() fOut.create(cFileOut) do while not fIn.eof() cRead = fIn.gets() If not chr(26)$cRead fOut.Puts(cRead) endif enddo fIn.close() fOut.close() new file().delete(cFileIn) new file().rename(cFileOut,cFileIn) msgbox('Done. master.csv has been created.') function escape_quote(cStr) for n = len(cStr) to 1 step -1 if substr(cStr,n,1) = ["] cStr = stuff(cStr,n,1,[\"]) endif next return cStr