>Hello,
> I am trying to move a sql statement in a memo field. The sql statement works fine in a program. I am getting syntax error after I put it into a memo field in a table. The SQL statement is a very long(about 15 lines),what do use for return charactor in the end of each line, should I use a ";" or chr(13) in the memo field. There are my code:
> cSQL = ALLTRIM(OUTPUT.OUTPUT_SQL)
> &cSQL
>thank you
You can't macro-expand a single command line split into multiple lines; you either need to compile it to a .PRG and execute the compiled statement, or strip the separators (line breaks and semicolon continuations) from the text. You could strip the line segmentation by:
cSQL = CHRTRAN(ALLTRIM(Output.Output_SQL),CHR(13) + CHR(10) + ';', SPACE(3))
&cSQL
If the memo field contains more than a single executable line of code, it can't be macro=expanded, and must be compiled. VFP6 with SP3 is capable of compiling a source code file for execution at runtime using the COMPILE statement.
>sherry