上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)'。 –