What is imprecise column in SQL Server?

爱⌒轻易说出口 提交于 2019-12-03 12:45:19

Per MSDN, CLR Function columns must be persisted to be indexed:

Any computed column that contains a common language runtime (CLR) expression must be deterministic and marked PERSISTED before the column can be indexed. CLR user-defined type expressions are allowed in computed column definitions. Computed columns whose type is a CLR user-defined type can be indexed as long as the type is comparable. For more information, see CLR User-Defined Types.

Persist the column and I suspect it will work.

From the SQL server documentation:

Any float or real expression is considered imprecise and cannot be a key of an index; a float or real expression can be used in an indexed view but not as a key. This is true also for computed columns. Any function, expression, or user-defined function is considered imprecise if it contains any float or real expressions. This includes logical ones (comparisons).

Have you tried:

[SqlFunction(IsDeterministic=true, IsPrecise=true)]

http://msdn.microsoft.com/en-us/library/orm-9780596101404-02-12.aspx

http://msdn.microsoft.com/en-us/library/ms189292.aspx

Sounds like the error message is misleading because CLR computed columns have to be persisted anyway (to be indexed).

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!