Cannot insert character '≤' in SQL Server 2008

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.

Answers


You need to use the N prefix so the literal is treated as Unicode rather than being treated as character data in the code page of your database's default collation.

update ruds_values_short_text 
set value = N'≤ asjdklasd'
where rud_id=12202 and field_code='detection_limit'

Need Your Help

JPA mapping: Foreign key must have same number of columns in the referenced primary key

hibernate jpa mapping jpa-2.0

I’m using JPA 2.0 with Hibernate 4.1.0.Final. I’m having trouble figuring out how to Map a couple of entities. I have a Group and a GroupMember class, but the following mappings …

Getting a what i believe to be a webclient error in C#, Need help Please

c# runtime-error webclient

Okay so i am fairly new to programming and was told to just start acouple projects and google/ask if i need hep so here i am, im making a program that will download and run a file from the internet...

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.