I am having trouble using a variable with single quotes in it in a cfquery

<CFSET t2="test">

<CFQUERY NAME="GetLastest" DATASOURCE="Info">
        select * from tblmessages where subject = ' #t2# '
</cfquery>

works fine.

However, I need to send a variable with an entire where clause such as:

<CFSET t2="subject like 'test' ">

<CFQUERY NAME="GetLastest" DATASOURCE="Info">
        select * from tblmessages where #t2# 
</cfquery>

Which returns an error (even though the query statement is the exact same
when it is printed out)
This should be easy but I can't figure it out.

Any help would be greatly appreciated.

Thank you,

Eric J. LeRoy
RST Database Admin/Software Developer
(716) 422-4682
[EMAIL PROTECTED]

------------------------------------------------------------------------------
Archives: http://www.mail-archive.com/[email protected]/
To Unsubscribe visit 
http://www.houseoffusion.com/index.cfm?sidebar=lists&body=lists/cf_talk or send a 
message to [EMAIL PROTECTED] with 'unsubscribe' in the body.

Reply via email to