Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
SQL
Message
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Title:
Re: SQL
Miscellaneous
Thread ID:
00257397
Message ID:
00257402
Views:
16
>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
EMail: EdR@edrauh.com
"See, the sun is going down..."
"No, the horizon is moving up!"
- Firesign Theater


NT and Win2K FAQ .. cWashington WSH/ADSI/WMI site
MS WSH site ........... WSH FAQ Site
Wrox Press .............. Win32 Scripting Journal
eSolutions Services, LLC

The Surgeon General has determined that prolonged exposure to the Windows Script Host may be addictive to laboratory mice and codemonkeys
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform