Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Parsing Long SQL Statements
Message
 
To
22/01/1999 11:53:46
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00178997
Message ID:
00179081
Views:
18
Break it into pieces and put them back together and run the string:

tsql1 = "SELECT fieldlist"
tsql2 = "more fields"
tfrom = "FROM ...."
twhere = "WHERE ...."
torder = "ORDER..."
tinto = "INTO ..."

tsql = m.tsql1 + m.tsql2 + m.tfrom + m.twhere + m.torder + m.tinto

&tsql

NOTE: No one line can be longer than 254 characters, but the combined length of of the mvars into tsql is unlimited.

BTW: In your example it should read DTOS(bs_arch.mail_date) >= '19981201' if bs_arch.mail_date is a date field.


>What's the best way to parse a long SQL statement into a string variable?
>
>For example:
>
>cquery = "select mastddup.location, mastddup.census, ;
>mastddup.name,mastddup.addr1, mastddup.city, mastddup.state, mastddup.zip,;
>mastddup.zip4,bs_arch.location, bs_arch.mail_date,bs_arch.mail_code from mastddup,;
>bs_arch where mastddup.location=bs_arch.location and bs_arch.mail_date >= '19981201' "
>
>The problem I've got with this particular string is the last "and" clause. I keep getting syntax errors.
Ken Sorce
Team RAD, Inc.
Rapid Application Developers
Ken@TeamRAD.com
www.teamrad.com
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform