开发者

How to use "." in LIKE query?

When i use . operator in LIKE operator query is not selecting any 开发者_开发问答of the records.

My query:

SELECT *
FROM XSP_AssetList_V 
WHERE AccountID = '5d6b1eab-1697-de11-a2d1-00505617006d'
AND PrinterSerialNumber
LIKE '%13.12%' 

How to use . in LIKE?


In SQL, the single character wildcard is "_" not "."

LIKE '%13_12%'
  • % match any string of zero or more characters.
  • _ match any single character.
  • [ ] match any single character within the specified range (for example, [a-f]) or set (for example, [abcdef]).
  • [^] match any single character not within the specified range (for example, [^a - f]) or set (for example, [^abcdef]).


what you are doing should work, maybe your AccountID is incorrect or the combination of both doesn't return anything

create table #test(ip varchar(16))
insert #test values ('13.121.238.11')
insert #test values ('13.124.254.128')
insert #test values ('127.0.0.1')

select * from #test where ip like '%13.12%' 
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜