Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why is sql server storing question mark characters instead of Japanese characters in NVarchar fields?

Tags:

sql-server

I'm trying to store Japanese characters in nvarchar fields in my SQL Server 2000 database.

When I run an update statement like:

update blah  set address = N'スタンダードチャ' where key_ID = 1 

from SQL Server Management Studio, then run a select statement I see only question marks returned to the results window. I'm seeing the same question marks in the webpage which looks at the database.

It seems this is an issue with storing the proper data right? Can anyone tell me what I need to do differently?

like image 234
Stimy Avatar asked Apr 17 '09 16:04

Stimy


People also ask

What special characters are allowed in NVARCHAR?

If you use nchar / nvarchar then it's pretty much any character in any unicode set in the world.


1 Answers

This cannot be a correct answer given your example, but the most common reason I've seen is that string literals do not need a unicode N prefix.

So, instead of

set address = N'スタンダードチャ' 

one would try to write to a nvarchar field without the unicode prefix

set address = 'スタンダードチャ' 

See also: N prefix before string in Transact-SQL query

like image 100
mika Avatar answered Sep 26 '22 21:09

mika