列是空的,但不符合where子句。

时间:2022-01-06 16:29:56

When I run this query:

当我运行这个查询时:

 select LR.ID, LR.HIDE 
 from Location_Room LR 
 where LR.LID = 19624

I get:

我得到:

列是空的,但不符合where子句。

When I run this 2nd query:

当我运行第二个查询:

 select LR.HIDE, ID 
 from Location_Room LR 
 where LR.LID = 19624 
   AND (LR.HIDE = ' ' OR LR.HIDE IS NULL or LR.HIDE = '' or datalength(LR.HIDE) = 0) 

I get this result:

我得到这个结果:

列是空的,但不符合where子句。

I need to check that HIDE isn't null or blank, but can't seem to do so.

我需要检查隐藏是否为空或空,但似乎不能这样做。

The column is set up like this:

这个专栏是这样设置的:

列是空的,但不符合where子句。

Why is this happening? How can I resolve it?

为什么会这样?我如何解决它?

1 个解决方案

#1


5  

It looks like you have a funny character in the data. You can see the ASCII value of the first character in hide by using ASCII():

看起来你的数据里有个有趣的人物。您可以使用ASCII()查看隐藏的第一个字符的ASCII值:

select ascii(left(hide, 1))
from Location_Room;

Or perhaps:

或者:

select ascii(left(ltrim(rtrim(hide)), 1))
from Location_Room;

#1


5  

It looks like you have a funny character in the data. You can see the ASCII value of the first character in hide by using ASCII():

看起来你的数据里有个有趣的人物。您可以使用ASCII()查看隐藏的第一个字符的ASCII值:

select ascii(left(hide, 1))
from Location_Room;

Or perhaps:

或者:

select ascii(left(ltrim(rtrim(hide)), 1))
from Location_Room;