简体   繁体   中英

SQL - Need help build a select query

I've a table (hosted in a database SQL Server) where i've products stored. The person who inserted a few products last week, instead of making new lines with "Enter" (tinyMCE would created a </br> tag) in description, she had typed "Space" creating white spaces (she though that typing white spaces, creates new line when it goes to the new line. Really dumb).

So, i've records something like this:

Description: &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp&nbsp;&nbsp;&nbsp;&nbsp&nbsp;&nbsp;&nbsp;&nbsp&nbsp;&nbsp;&nbsp;&nbsp&nbsp;&nbsp;&nbsp;&nbsp&nbsp;&nbsp;&nbsp;&nbsp;

Now i'm trying to create a query for search this records, but i think i'm using LIKE operator in a wrong way.

SELECT * From ProductsDescription WHERE Description LIKE '%&nbsp;&nbsp;'

It's returning 0 rows. Is anything wrong in that query?

Thanks

如果最后一个字符不是分号,请尝试在末尾添加另一个百分号,例如:

SELECT * From ProductsDescription WHERE Description LIKE '%&nbsp;&nbsp;%'
  1. Get rid of the spaces inside the single-quotes.
  2. Append another % .

Eg:

SELECT * From ProductsDescription WHERE Description LIKE '%&nbsp;&nbsp;%';

Edit:
Ignore point #1 above. As @Hippo notes in a comment that was simply a formatting issue. I have edited the question to remove the extraneous spaces.

select * from ProductsDescription where description like '%nbsp%'

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM