Store unicode codepoint in varchar(SQL Server)

344 Views Asked by At

When I create the following table in SQL Server (2016)

create table test100(Id int not null primary key identity, str1 varchar(100))

And then insert following data :

insert into test100(str1) values(nchar(1610))

The character "ی" is recorded in the table, That is, the Unicode character was stored in the ascii field :

select substring(str1,1,1),
      ascii(substring(str1,1,1)),
      unicode(substring(str1,1,1)),
      DATALENGTH(str1),
from test100

Why is the Unicode character stored in ascii field?

Database collation : SQL_Latin1_General_CP1256_CI_AS

0

There are 0 best solutions below