I have a SQL statement stored in a table like following.
SELECT * FROM MyTable1 where 0=0
AND FinalStatus IN (2,8)
AND datediff(day,getDate(),activedate) <= (25)
AND State IN ('AK','FL')
Order by ID
I am getting that value with the following query
<cfquery name="myQuery" datasource="myDatasource">
Select * from MyTable2 WHERE ID = #pMyID#
#myQuery.sqlQuery# is replacing one of my AND condition, which is AND State IN ('AK','FL') TO AND State IN (''AK'',''FL'').
It is placing the single quotes twice when i get the value and is causing my query to fail with error Incorrect syntax near 'AK'.
Is there any way to avoid this? Please help me out.
Thanks in advance.