我有以下查询在SQL Server中执行时返回1条记录:
SELECT * from item WHERE lower(_name) like '%icc (initial)%'
当我在ColdFusion页面中运行它时,它返回0条记录。
ColdFusion查询代码:
<cfset skipChck = Trim(lcase("ICC (Initial)"))>
<cfquery name="result" datasource="#application.dsn#">
SELECT * from item
WHERE 1=1
AND lower(_name) like '%#skipChck#%'
</cfquery>
或
<cfquery name="result" datasource="#application.dsn#">
SELECT * from item
WHERE 1=1
AND lower(_name) like <cfqueryparam cfsqltype="cf_sql_varchar" value="%#skipChck#%">
</cfquery>