以上方法都不可以,我的数据类型是从ntext转换成cats(column as nvarchar(4000))的,我把那个空的记录放到记事本中,发现了好像有一个回车,还有我用ascii查看他们,那些地方显示null,但是用 column is not null还是不管用,为什么
--你把char(10),char(13),Null,' ',都排除掉不就可以了吗? where replace(replace(replace(column,' ',''),char(10),''),char(13),'')=''
select replace(cast(description as varchar(3333)),'" border="0" hspace="0" vspace="0" width="234" height="1"> ','') from data_6 where web_url like 'http://www.stakich.com%' and cast(description as varchar(3333)) is not null这是我的那个语句,但是最后查询出来的,还有空的记录,难道我的sql有问题么
where web_url like 'http://www.stakich.com%' and cast(description as varchar(3333)) is not null你的这句 cast(description as varchar(3333)) is not null 中'is not null'是表示该字段不是'未知值'.也就是说除了'未知值',你还要处理已知的char(10),char(13),' '等值 --试这个 where web_url like 'http://www.stakich.com%' and replace(replace(replace(cast(isNull(description,'') as varchar(3333)),' ',''),char(10),''),char(13),'')=''
我用len(column)<>0 这个把问题解决掉了,但是我很想知道我的那个方法为什么不可以呢, where column is not null 和where column<>''这些方法最后的结果都还是显示出了那个字段为空的情况。
where replace(replace(replace(column,' ',''),char(10),''),char(13),'')=''
select replace(cast(description as varchar(3333)),'" border="0" hspace="0" vspace="0" width="234" height="1"> ','')
from data_6
where web_url like 'http://www.stakich.com%' and cast(description as varchar(3333)) is not null这是我的那个语句,但是最后查询出来的,还有空的记录,难道我的sql有问题么
--试这个
where web_url like 'http://www.stakich.com%' and replace(replace(replace(cast(isNull(description,'') as varchar(3333)),' ',''),char(10),''),char(13),'')=''
where column is not null 和where column<>''这些方法最后的结果都还是显示出了那个字段为空的情况。