I'm looking for fast way to see all rows in table that contains any spaces.
For starters, I tried to see which rows starts with space by this query:
select *
from MyTable
where ColumnName like ' %'
but I got 0 results, although I can see there are rows with spaces.
4条答案
按热度按时间cmssoen21#
Give this a try:
In SQL server you can use this:
If you are using Oracle you can use this:
Essentially in this query it finds the character position containing first space from the column values and when it finds the first space in it the index value should be greater than 1 and it should display all the records based on that.
wwwo4jvm2#
Seem that those space contain some other special character apart from char(10).
Try this,
First decide what is valid value for ColumnName .Then try
PATINDEX
and change the regex accordingly.vuktfyat3#
try put another '%', this may solve your problem.
select * from MyTable where ColumnName like '% %'
gab6jxml4#