问题
In a nvarchar(512)
field if i store unicode chars like this:
UPDATE MYTABLE SET UNICODEFIELD = 'TレEホSᅯTル'
when i query it i get
T?E?S?T?
It looks like the "unusual" chars are not considered as unicode, i would expect the "?" behavior in case of varchar
, while with nvarchar
it should work fine, i am expecting
TレEホSᅯTル
as output, instead of
T?E?S?T?
Does anyone have an idea about this?
回答1:
Because you're using a varchar
, not an nvarchar
. 'TレEホSᅯTル'
= 'T?E?S?T?'
as characters like レ
can't be stored in a varchar
.
Use a literal nvarchar
:
UPDATE MYTABLE SET UNICODEFIELD = N'TレEホSᅯTル';
来源:https://stackoverflow.com/questions/57091882/sql-server-returns-question-mark-for-some-unicode-chars