atricapilla atricapilla - 1 month ago 6
SQL Question

SQL Server 2008: How to find trailing spaces

How can I find all column values in a column which have trailing spaces? For leading spaces it would simply be

select col from table where substring(col,1,1) = ' ';

Answer

SELECT col FROM tbl WHERE col LIKE '% '