What database are you using? preserveSingleQuotes() has always worked for me, exactly as intended.
However, before you go too far down this road, I'd recommend not using CFSCRIPT for this code, because there is a query inside. Sure, you can make a wrapper, as you tried, but doing that will prevent you from using CFQUERYPARAM, will force you to put your SQL in a string (rather than inlined, where it's both easier to read, and available for tools to operate on), and will generally make for code that's less readable, because it's dramatically different than 99.9% of CF code (which uses CFQUERY directly). Of course, you're the one with the knowledge of your particular situation, not I, so you're the only one who can make an informed decision. So don't just assume I know what I'm talking about, and that it applies to your specific case. cheers, barneyb On Wed, 8 Dec 2004 15:20:54 -0500, C. Hatton Humphrey <[EMAIL PROTECTED]> wrote: > Okay, to try and make my life easier I decided to try changing a block > of code from CFSet to CFScript. > > However, part of what I need to do in this code is run a query based > on a variable value... I'm pulling a label out of a record body and > need to get the id of a record where a certian field matches that > value. I'm reading an email that contains fixed width tables that > hold some data I need to import. > > Anyway, I made all the CFScript changes and created a query called > "RunQuery" that takes one parameter - SQL Statement. If I had SQL > Server I know how I would do this, using a stored procedure. but I > don't. > > When I try to pass the generated SQL Statement (select .... from .... > where label = '#This_Label#') CF is barfing on me because it instantly > escapes the single quotes. When I tried adding "preserve > singlequotes" the error comes up looking at the sinqlequoetes with a \ > in front... nice way of preserving those quotes. > > Any suggestions? I've had to revert the code back to a ton of CFSets > until I can get the queries working. > > Thanks! > Hatton > -- Barney Boisvert [EMAIL PROTECTED] 360.319.6145 http://www.barneyb.com/blog/ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~| Special thanks to the CF Community Suite Silver Sponsor - CFDynamics http://www.cfdynamics.com Message: http://www.houseoffusion.com/lists.cfm/link=i:4:186682 Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4 Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4 Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4 Donations & Support: http://www.houseoffusion.com/tiny.cfm/54