So long as the query is enclosed in quotes and properly escaped, you
shouldn't have any problems.  Something like:

<CFSET sql = "SELECT foo FROM bar WHERE baz = 'yadda'">

<CFQUERY NAME="InsertSQL" DATASOURCE="#ds#">
INSERT INTO foo
(
sqlCode
)
VALUES
(
'#Replace(sql, "'", "''", "ALL")#'
)
</CFQUERY>

or, using CFQueryParam:

...
<CFQUERYPARAM CFSQLTYPE="CF_SQL_VARCHAR" VALUE="#sql#">
...

--
Mosh Teitelbaum
evoch, LLC
Tel: (301) 942-5378
Fax: (301) 933-3651
Email: [EMAIL PROTECTED]
WWW: http://www.evoch.com/

Scott Stewart wrote:
> Here's kind of a weird one folks. I'm trying to insert a sql query string
> into a text field. The DB will be queried on a scheduler and the string
> inserted into a query.
>
> I've tried PreserveSingleQuotes but CF still tries to run the query string
> instead of inserting it.
[Todays Threads] [This Message] [Subscription] [Fast Unsubscribe] [User Settings] [Donations and Support]

Reply via email to