我正在使用SQL Server 2012使用以下T-SQL SP查询IBM iSeries:
exec ('select
TRIM (vhitno) AS Item,
TRIM (mmitds) AS Description,
TRIM (SUBSTRING (vhitno,12,4)) AS Size,
vhalqt AS Available
from m3fdbtest.oagrln
left outer join
m3fdbtest.mdeohe on vhcono=uwcono and vhcuno=uwcuno and vhagno=uwagno and vhitno=uwobv1
left outer join
m3fdbtest.mitmas ON vhcono = mmcono AND vhitno = mmitno
where
uwcono=1
and
uwcuno=''JBHE0001''
and
uwagst=''20''
and
vhitno LIKE ? '
, '%' + @Search + '%') at M3_TEST_ODBC
传递的参数,@ Search需要成为一张外卡。我一直收到消息:
Incorrect syntax near '%'.
我哪里错了?
由于
答案 0 :(得分:1)
有了它的工作 - 谢谢你@Dan Guzman你对竖条是正确的:
{{1}}
答案 1 :(得分:0)
,则必须使用“LIKE”而不是“=”。
(vhitno喜欢?还是mmitds喜欢?')
ex:vhitno喜欢'%test%'