Special Character in SQL
ascii, sql-server
Solution
The degree symbol
U+00B0 ° degree sign (HTML: ° °)
is not an ASCII character and generally requires an NVARCHAR column and a `N''` string literal. (except for codepages etc that support the symbol)
63 is the code of the question mark, which is the fallback for your inverse question mark in ASCII:
select UNICODE('�') => 63
select UNICODE(N'�') => 65533
where 65533 is the Unicode Replacement Character used to display characters that could not be converted or displayed.
Problem
I have a problem with a special character inserted in a table of SQL Server 2008 R2. The point is that when i'm trying to insert a string with the character º (e.g. 3 ELBOW 90º LONG RADIUS) in the table this appears like this: 3 ELBOW 90� LONG RADIUS, and when i'm trying to select all the rows that contains the character � the result is null. I tried to make the select with ASCII by making this: select * from itemcode where description like '%'+char(63)+'%' and make this to know that the ASCII of that symbol is 63: select ASCII('�') But that doesn't work. What i must do to select all the rows that have that character and what should i do to make that SQL recognize the character º? Thanks