在CF和SQL Server中执行时,相同的查询返回不同的结果

时间:2016-10-13 23:52:09

标签: sql-server sql-server-2008 coldfusion

我有以下查询在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>

0 个答案:

没有答案