SQL在哪里用=语句工作,但LIKE没有解决这个问题吗?
这是确切的代码:
create table zSyn (xField nvarchar(255)); insert into zSyn(xField) select 'DEVCON 5 Minute Epoxy amber [1:1]'; --Works and returns 1 row: select * from zSyn where xField = 'DEVCON 5 Minute Epoxy amber [1:1]'; --Does NOT return any rows: select * from zSyn where xField like '%' + 'DEVCON 5 Minute Epoxy amber [1:1]' + '%'
Lukasz Szozd.. 6
您需要逃脱[]
:
select * from zSyn where xField like ('%' + 'DEVCON 5 Minute Epoxy amber ![1:1!]' + '%') ESCAPE '!';
db <> fiddle演示
您需要逃脱[]
:
select * from zSyn where xField like ('%' + 'DEVCON 5 Minute Epoxy amber ![1:1!]' + '%') ESCAPE '!';
db <> fiddle演示