If you're using VFP 8 or 9, check out the PRETEXT option in the TEXT..ENDTEXT command. It will remove all the white space for you. Also, you could dump the semi-colons, although that would make it harder to maintain your inline comments. Having said that, TSQL also supports inline comments so you could work around that by changing && to --. I also find the TEXTMERGE & ADDITIVE options very useful.
Garrett Fitzgerald wrote: > I mentioned earlier this year that I was using tricks when building > statements to send through SQL passthru. I just ran across the > following one, and figured I'd share FWIW. > > I put lcQueryFormat on the first page of the report: then I strip > everything out that the server's going to choke on. > > TEXT TO lcQueryFormat NOSHOW > SELECT Person.searchName, Person.patientId, Person.dateOfBirth ; > SNIP ; > FROM ml.Person Person ; > SNIP ; > LEFT JOIN ml.Problem ON Person.pID = Problem.pID ; > AND (Problem.code LIKE 'ICD-578.9%' ; && GI bleeding > && > OR Problem.code LIKE 'ICD-599.7%' ; && > Hematuria && > OR Problem.code LIKE 'ICD-924.9%' ; && > Hematoma && > OR Problem.code LIKE 'ICD-432.9%' ; && > Intracranial hemorrhage && > OR Problem.code LIKE 'ICD-287.9%' ; && > Bleeding disorder && > ) > ENDTEXT > > lcQueryFormat = CHRTRAN(lcQueryFormat, ";", "") > > lcQuery = CHRTRAN(lcQueryFormat ; > , CHR(9) + CHR(10) + CHR(13) ; > , " ") > lcComment = "&" + "&" && For obvious reasons... > lcQuery = RegExp(lcQuery, lcComment + "[^&]+" + lcComment, 1, "") > > -- Richard Kaye Vice President Artfact/RFC Systems Voice: 617.219.1038 Fax: 617.219.1001 For the fastest response time, please send your support queries to: Technical Support - [EMAIL PROTECTED] Internet Support - [EMAIL PROTECTED] All Other Requests - [EMAIL PROTECTED] --------------------------------------------------------- This message has been checked for viruses before sending. --------------------------------------------------------- _______________________________________________ Post Messages to: [email protected] Subscription Maintenance: http://leafe.com/mailman/listinfo/profox OT-free version of this list: http://leafe.com/mailman/listinfo/profoxtech Searchable Archive: http://leafe.com/archives/search/profox This message: http://leafe.com/archives/byMID/profox/[EMAIL PROTECTED] ** All postings, unless explicitly stated otherwise, are the opinions of the author, and do not constitute legal or medical advice. This statement is added to the messages for those lawyers who are too stupid to see the obvious.

