在SQL Server 2008中,我尝试将两个字符串与常规文本进行比较,另一个字符串与嵌入式双向文本字符U + 202A(LRE字符)进行比较。我希望结果是" Not Equal",但它会让我回复#34; Equal"。我使用错误的整理顺序吗?
DECLARE @v1 NVARCHAR(40) = N'test'
-- 8234 U+202A LRE (Bidirectional Text)
DECLARE @v2 NVARCHAR(40) = N'T' + nchar(8234) + N'est';
PRINT @v1
PRINT @v2
IF @v1 = @v2 PRINT 'Equal' ELSE PRINT 'Not Equal'
IF @v1 COLLATE Latin1_General_CI_AS = @v2 COLLATE Latin1_General_CI_AS
PRINT 'Equal' ELSE PRINT 'Not Equal';
IF @v1 COLLATE Latin1_General_CI_AS_WS = @v2 COLLATE Latin1_General_CI_AS_WS
PRINT 'Equal' ELSE PRINT 'Not Equal';
test
T est
Equal
Equal
Equal