上nvarchar
类型的计算列创建索引提出了以下错误:什么是SQL Server中的不精确列?
Cannot create index or statistics 'MyIndex' on table 'MyTable' because the computed column 'MyColumn' is imprecise and not persisted. Consider removing column from index or statistics key or marking computed column persisted.
是什么不精确列是什么意思?
UPDATE。定义如下:
alter table dbo.MyTable
add [MyColumn] as dbo.MyDeterministicClrFunction(MyOtherColumn)
go
create index MyIndex on dbo.MyTable(MyColumn)
go
UPDATE2。该MyDeterministicClrFunction
定义如下:
[SqlFunction(IsDeterministic = true)]
public static SqlString MyDeterministicClrFunction(SqlString input)
{
return input;
}
你想用什么公式计算列值? – Yuck
它是'nvarchar(xx)'还是'nvarchar(max)'? – JNK
'MyOtherColumn'其他列是'nvarchar(50)'。 –