问题
I am trying to add this name -> NumāTwó into a table in MS sql server along with the accents. But it is only getting inserted as -> NumaTwó (without ā). I tried many encodings but doesn't seem to work. I have given the DDL of the table below. Please help
CREATE TABLE [dbo].[test](
[testname] [nvarchar](40) COLLATE SQL_Latin1_General_CP1253_CI_AI NULL
) ON [PRIMARY]
----------- Insert-----------
insert into test values ('NumāTwó');
回答1:
use N
as Prefix for Unicode character
CREATE TABLE [dbo].[test](
[testname] [nvarchar](40) COLLATE SQL_Latin1_General_CP1253_CI_AI NULL
) ON [PRIMARY]
----------- Insert-----------
insert into test values (N'NumāTwó');
回答2:
Try to use N before the string while inserting like this:
insert into test values (N'NumāTwó');
来源:https://stackoverflow.com/questions/33391071/accents-not-getting-inserted-in-sql-server