0
爲什麼在以下腳本中,charindex在SQL Server 2008 R2中返回的值不是0?nvarchar字段中的不可見字符?
--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
在我的分貝實例產生的輸出(使用歸類:SQL_Latin1_General_CP1_CI_AS):
(1 row(s) affected)
(1 row(s) affected)
(1 row(s) affected)
²
³
¹