当前位置: 动力学知识库 > 问答 > 编程问答 >

sql - why [!charlist1] and [characters not in charlist1] not working in same way

问题描述:

So here are the 2 queries I wrote

select Name from tblEmployees where Name not like '%[! -.]%[ .-]%[! -.]%' order by Name;

select Name from tblEmployees where Name not like '%[a-z]%[ .-]%[a-z]%' order by Name;

surprisingly both are having different results and even more surprising is the fact that 1st query shows more results than 2nd one..

any possible reasons why both queries not working in same way,

I don't think because the characters used in tblEmployees in Names have any other characters than a-z', '' (space) . and -.

I have run the queries in SOL server management.

网友答案:

It should be

[^ -.]

instead of

[! -.]
分享给朋友:
您可能感兴趣的文章:
随机阅读: