Sindu_
Sindu_

Reputation: 1455

Accents not getting inserted in SQL server

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ó');

Upvotes: 1

Views: 2330

Answers (2)

wiretext
wiretext

Reputation: 3342

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ó');

Upvotes: 6

Rahul Tripathi
Rahul Tripathi

Reputation: 172448

Try to use N before the string while inserting like this:

insert into test values (N'NumāTwó');

Upvotes: 3

Related Questions