我有两张桌子就是其中之一
AI: Ascent insensitive
和其他AS: Ascent sensitive
我如何比较它们并区分它们?我使用了except
select ID,FIRST,FATHER,GRAND from t1
EXCEPT
select ID,FIRST,FATHER,GRAND from t2
但我收到了这个错误:
无法解决" Arabic_CI_AS"之间的整理冲突和 " Arabic_100_CI_AI"在EXCEPT操作中
答案 0 :(得分:1)
选择一个合适的校对,以便字符串的比较符合要求(例如G." CI" =区分大小写/不区分大小写),使用您的校对这样(忽略字符串的问题) ID
中的EXCEPT
列:
select ID,
FIRST collate Arabic_CI_AS,
FATHER collate Arabic_CI_AS,
GRAND collate Arabic_CI_AS
from t1
EXCEPT
select ID,
FIRST collate Arabic_CI_AS,
FATHER collate Arabic_CI_AS,
GRAND collate Arabic_CI_AS
from t2
答案 1 :(得分:1)
它在这里工作
USE [TestDb] GO
表1
CREATE TABLE [dbo].[t1](
[ID] [int] IDENTITY(1,1) NOT NULL,
[FIRST] [nchar](10) NULL,
[FATHER] [nchar](10) NULL,
[GRAND] [nchar](10) NULL,
CONSTRAINT [PK_t1] PRIMARY KEY CLUSTERED
(
[ID] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]
GO
表2
CREATE TABLE [dbo].[t2](
[ID] [int] IDENTITY(1,1) NOT NULL,
[FIRST] [nchar](10) NULL,
[FATHER] [nchar](10) NULL,
[GRAND] [nchar](10) NULL,
CONSTRAINT [PK_t2] PRIMARY KEY CLUSTERED
(
[ID] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]
GO