select * from mytable where rtrim(isnull(name,''))!=''
select * from mytable where name is not null and name not like '% %'
declare @t table (id varchar(10)) insert into @t select '1' union all select ' ' union all select null union all select '2'select * from @t/* id ---------- 1 --此处为空格 NULL 2(4 行受影响)*/ select * from @t where id<>' ' /* id ---------- 1 2(2 行受影响)*/
select * from mytable where rtrim(isnull(name,''))!=''
select * from mytable where rtrim(isnull(name,''))!=''
select * from mytable where rtrim(isnull(name,''))!=''
select * from mytable where len(isnull(name,''))>0
select * from mytable where isnull(name,'') <> ''
select * from mytable where name>''
select * from mytable where name>''
select * from TableName where RTRIM(LTRIM(ISNULL(id,'')))<>''
insert into @t
select '1' union all
select ' ' union all
select null union all
select '2'select * from @t/*
id
----------
1
--此处为空格
NULL
2(4 行受影响)*/
select * from @t where id<>' '
/*
id
----------
1
2(2 行受影响)*/
select * from mytable where len(isnull(name,''))>0
select * from mytable where isnull(name,'') <> ''
WHERE ISNULL(name,'')<>''
len(ltrim('')) <> 0