LOCAL cChar, cFields, cFile, nReccount, nStartTime, ix SELECT * FROM h:\ids5\dbfs\t_tanklayout INTO CURSOR _tmpXML NOFILTER READWRITE nReccount = RECCOUNT() cFile = SYS(2015)+'.tmp' nStartTime=SECONDS() cChar=CHR(13) cFields = "fb=IIF(RECNO() = 1,'<TEST>'+CHR(13),'')+CHR(9)+'<CLIENT>'," FOR ix=1 TO FCOUNT() IF !TYPE(FIELD(ix))$'GM' cFields = cFields + "f"+ALLTRIM(STR(ix))+"=CHR(9)+CHR(9)+'<"+FIELD(ix)+">'+" cFields = cFields + IIF(TYPE(FIELD(ix))$'CM', FIELD(ix), "Transform("+FIELD(ix)+")")+"+" cFields = cFields + "'</"+FIELD(ix)+">'," ENDIF ENDFOR cFields = cFields + "F"+ALLTRIM(STR(ix))+"=chr(9)+'</CLIENT>'+IIF(RECNO() = nReccount,CHR(13)+'</TEST>','')" SET FIELDS GLOBAL SET FIELDS TO &cFields COPY TO (cFile) TYPE DELIMITED WITH "" WITH CHARACTER &cChar SET FIELDS TO ? SECONDS() - nStartTime MODIFY FILE (cFile) ERASE (cFile) RETURNI don't think it can be written much faster than this. Even the CURSORTOXML() function is not significantly faster than this.