I hava a column name which is a varchar
I want to filter all results where name is an empty string…
select name
from tblNames
where name <> ''
What I want to do is:
select name
from tblNames
where Ltrim(RTrim(name)) <> ''
I want to apply a trim on name in the where clause but I have read a few articles mentioning the performance issue of functions inside the where clause
I want a solution to this without hurting performance
Standard behaviour in SQL-Server is that
is
TRUE, because trailing spaces are ignored. From MSDN support:So, your condition
WHERE name <> ''should work fine, and not include any strings where there are only spaces.