为什么 select 不在 json 字符串中使用 like 查询?

Why doesn't select using like query in json string?

我可以找到这个查询

SELECT * 
FROM Table 
WHERE CODE_DESC = '{"title:\["1","2","3"\]"}'

但是,我找不到这个查询

SELECT * 
FROM Table 
WHERE CODE_DESC LIKE '%{"title:\["1","2","3"\]"}%'

有什么不同?

我这样试过:

SELECT * 
FROM Table 
WHERE CODE_DESC LIKE '% {"title:\["1","2","3"\]"} %'

SELECT * 
FROM Table 
WHERE CODE_DESC LIKE '%{"title:\["1","2","3"\]"}%'

但是,我无法解决问题

在sql-server中你需要转义[]的点赞,见:LIKE (Transact-SQL)

这也有效(将 [ 替换为 _,它匹配任何单个字符:

SELECT * 
FROM Table 
WHERE CODE_DESC LIKE REPLACE('%{"title:\["1","2","3"\]"}%','[','_')