I have a SQL Query build as a string but i cant seem to pass it into to the <cfquery>
But it does not work
any one can help me?
<cfif ISDEFINED ('member')>
<CFSET SQL = "SELECT *
FROM precontract ">
<CFSET SQL_Coubr = 0 >
<cfif form.member neq "">
<cfif SQL_Coubr eq 0>
<CFSET SQL = SQL& " WHERE " >
<cfelse>
<CFSET SQL = SQL& " OR " >
</cfif>
<CFSET SQL = SQL& " name LIKE '%#form.member#%' " >
<CFSET SQL_Coubr = 1 >
</cfif>
<cfif form.Email neq "">
<cfif SQL_Coubr eq 0>
<CFSET SQL = SQL& " WHERE " >
<cfelse>
<CFSET SQL = SQL& " OR " >
</cfif>
<CFSET SQL = SQL& " email LIKE '%#form.Email#%' " >
<CFSET SQL_Coubr = 1 >
</cfif>
<cfif form.Phone neq "">
<cfif SQL_Coubr eq 0>
<CFSET SQL = SQL& " WHERE " >
<cfelse>
<CFSET SQL = SQL& " OR " >
</cfif>
<CFSET SQL = SQL& " phone LIKE '%#form.Phone#%' " >
<CFSET SQL_Coubr = 1 >
</cfif>
<cfif form.ContractNumber neq "">
<cfif SQL_Coubr eq 0>
<CFSET SQL = SQL& " WHERE " >
<cfelse>
<CFSET SQL = SQL& " OR " >
</cfif>
<CFSET SQL = SQL& " conID LIKE '%#form.ContractNumber#%' " >
<CFSET SQL_Coubr = 1 >
</cfif>
<cfoutput>#SQL#</cfoutput>
<cfquery datasource="mssqlcf_modelprod" dbname="modelprod" name="get_prememb">
SQL
</cfquery>
</cfif>