Sql server 2008 r2 nvarchar字段中的不可见字符?

Sql server 2008 r2 nvarchar字段中的不可见字符?,sql-server-2008-r2,Sql Server 2008 R2,为什么在SQL Server 2008 R2中,charindex在以下脚本中返回的值不是0 --drop table #tmp --go create table #tmp (field1 nvarchar(50)) go insert into #tmp values (N'Value 1') go insert into #tmp values (N'Value 2') go insert into #tmp values (N'Value 3') go DECLARE @i I

为什么在SQL Server 2008 R2中,charindex在以下脚本中返回的值不是0

--drop table #tmp
--go

create table #tmp (field1 nvarchar(50))
go
insert into #tmp values (N'Value 1')
go
insert into #tmp values (N'Value 2')
go
insert into #tmp values (N'Value 3')
go


DECLARE @i   INT;
DECLARE @c   NCHAR;
declare @nvc nvarchar(50) = N'Test Value';

SET @i = 128;


WHILE @i < 256
BEGIN
  SET @i = @i + 1;
  SET @c = nchar(@i);

  if exists (select 1 from #tmp t where charindex (@c, t.field1) > 0)
    print @c;
END

字符“2”和“上标2”都具有相同的unicode数值2,因此我假设SQL server将它们视为基于unicode字符的此组件的等效值,而不仅仅是其外观

(1 row(s) affected)

(1 row(s) affected)

(1 row(s) affected)
²
³
¹