【发布时间】:2017-04-05 08:32:48
【问题描述】:
我有下表:
[dbo].[TableName]
(
[created] datetime not null,
[modified] datetime null,
[computedValue] as
(
format([created], 'yyy-MM-dd MM/dd/yyy') +
case when ([modified] is not null)
then
(format([modified], 'yyyy-MM-dd MM/dd/yyyy'))
end
)
当我尝试更改此表上的全文索引时,就会出现问题。
ALTER FULLTEXT INDEX ON [dbo].[TableName] ADD ([computedValue] LANGUAGE 1033);
作为回应,我收到以下错误:
Computed column 'computedValue' cannot be used for full-text search because it is nondeterministic or imprecise nonpersisted computed column.
根据 MSDN : https://msdn.microsoft.com/en-us/library/ms181984(v=sql.110).aspx
“所有内置字符串函数都是确定性的。” 所以我绞尽脑汁为什么它说这个专栏不是确定性的。
【问题讨论】:
-
这个答案显示了对
FORMAT()的大量研究及其状态为deterministic vs. non-deterministic: stackoverflow.com/a/37695342/5089204
标签: sql tsql full-text-indexing deterministic