我与Columns AgreementID int和BaseAgreementNumber NVARCHAR(20)签订了一份协议,其中包含以下数据。
+-------------+----------------------+
| AgreementID | BaseAgreementNumber |
+-------------+----------------------+
| 181672 | 365141240514359 |
| 179078 | 15943 |
+-------------+----------------------+
记录ID 189072未显示在结果中,而记录ID为179078。
有人可以解释为什么会这样吗?
是使用以下脚本创建的表
CREATE TABLE [dbo].[Agreement](
[AgreementID] [int] IDENTITY(1,1) NOT NULL,
[BaseAgreementNumber] [nvarchar](20) NULL,
CONSTRAINT [PK_Agreement] PRIMARY KEY CLUSTERED
(
[AgreementID] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, FILLFACTOR = 90) ON [PRIMARY]
) ON [PRIMARY]
全文目录创建如下
CREATE FULLTEXT INDEX ON [dbo].[Agreement] KEY INDEX [PK_Agreement] ON ([AIMIEFTS]) WITH (CHANGE_TRACKING AUTO)
GO
ALTER FULLTEXT INDEX ON [dbo].[Agreement] ADD ([BaseAgreementNumber] LANGUAGE [Neutral])
GO
以下查询不返回任何行
select * from Agreement where CONTAINS(BaseAgreementNumber, '365141240514359')
但是这个查询会返回行。
select * from Agreement where CONTAINS(BaseAgreementNumber, '15943')