Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Query MS SQL for empty spaces(  or \xa0)

Tags:

sql

unicode

ascii

When exporting some data from MS SQL Server using Python, I found out that some of my data looked like computer \xa0systems which is causing encoding errors. Using SQL Management Studio the row simply appears to be double spaced: computer systems. It seems that this is the code for  : how can I query MS SQL Server within management studio to find all instances of this? things like WHERE ColumnName LIKE % % are not working, nor are querying on nbsp; or \\xa0

like image 237
iboeno Avatar asked Jun 28 '10 21:06

iboeno


People also ask

How do I select a space in SQL?

To select a column name with spaces, use the back tick symbol with column name. The symbol is ( ` `). Back tick is displayed in the keyboard below the tilde operator ( ~).


1 Answers

I used WHERE ColumnName LIKE '%' + CHAR(160) + '%'

160 is the ascii for "non breaking space".. which is 0xA0 in hex as per your \xao

like image 176
gbn Avatar answered Sep 22 '22 07:09

gbn