I have a SQL Server 2008 database and a nvarchar(256) field of a table. The crazy problem is that when I run this query:
update ruds_values_short_text
set value = '≤ asjdklasd'
where rud_id=12202 and field_code='detection_limit'
and then
select * from ruds_values_short_text
where rud_id=12202 and field_code='detection_limit'
I get this result:
12202 detection_limit = asjdklasd 11
You can see that the character ≤ has been transformed in =
It’s an encoding related problem, for sure, in fact, if I try to paste ‘≤’ in Notepad++ it pastes ‘=’ but I get ‘≤’ when I convert ANSI to UTF-8.
So.. I think I should write the query in UTF8.. but how? Thanks.
You need to use the
Nprefix so the literal is treated as Unicode rather than being treated as character data in the code page of your database’s default collation.