declare @CustField6 nvarchar(10)
declare @sample nvarchar(10)
set @CustField6 = 'sf'
select customer_id from csu_customer_policy
inner join csu_policy on csu_policy.policy_number = csu_customer_policy.policy_number
and csu_policy.data_source = csu_customer_policy.data_source
where csu_policy.vehicle_no like + '''' + @CustField6 + '%''' and csu_customer_policy.delete_status = 0 and csu_customer_policy.site_id = 1
我想要所有csu_policy.vehicle_no
以sf%
如果我sf
直接给出值而不是 @CustField6
给出我的所有记录但是当我使用@CustField6
它执行它时不会给出任何错误但没有检索到任何记录,即使我打印了这段代码来检查查询是否正确被框定,并且它正在工作美好的。但我不知道为什么它没有检索任何记录?