If I have a query such as:-
<CFQUERY name = etc etc>
SELECT * From MyTable
WHERE Surname = 'Smith'
</cfquery>
it works fine.
However, if I do the following:-
<CFSET WhereClause = "Surname = 'Smith'">
<CFQUERY name = etc etc>
SELECT * From MyTable
WHERE #WhereClause#
</cfquery>
When I run the query I get Incorrect Syntax Near '='.
Any ideas?
I've tried using PreserveSingleQuotes but it didn't make any difference.
<CFQUERY name = etc etc>
SELECT * From MyTable
WHERE Surname = 'Smith'
</cfquery>
it works fine.
However, if I do the following:-
<CFSET WhereClause = "Surname = 'Smith'">
<CFQUERY name = etc etc>
SELECT * From MyTable
WHERE #WhereClause#
</cfquery>
When I run the query I get Incorrect Syntax Near '='.
Any ideas?
I've tried using PreserveSingleQuotes but it didn't make any difference.