安装 VS2015 后,SQL Server 无法再为 hierarchyid CLR 类型调用 ToString() 方法 - 对于某些值它有效,对于其他值它会引发以下异常:
After installing VS2015, SQL Server can no longer call ToString() method for hierarchyid CLR type - for some values it works, for others it throws the following exception:
在执行用户定义的过程中发生 .NET Framework 错误常规或聚合层次结构":Microsoft.SqlServer.Types.HierarchyIdException: 24000: SqlHierarchyId操作失败,因为 HierarchyId 对象是从一个无效的二进制字符串.
A .NET Framework error occurred during execution of user-defined routine or aggregate "hierarchyid": Microsoft.SqlServer.Types.HierarchyIdException: 24000: SqlHierarchyId operation failed because HierarchyId object was constructed from an invalid binary string.
这可以通过运行以下简单查询轻松重现:
This is easily reproduced by running the following simple query:
从 HumanResources.Employee 中选择 OrganizationNode.ToString()
select OrganizationNode.ToString() from HumanResources.Employee
我尝试卸载 .NET 4.5.3,但没有帮助.任何已知的解决方法?尝试将hierarchyid 值转换为VARCHAR 导致了同样的错误,所以我假设它在幕后调用了ToString().
I tried uninstalling .NET 4.5.3, but it didn't help. Any known workarounds? Trying to CAST the hierarchyid value to VARCHAR resulted with the same error, so I assume it calls ToString() under the hood.
Visual Studio 2015 CTP6 修复了这个问题.
Visual Studio 2015 CTP6 fixes this.
将 CTP5(确实修复了一小段时间)更改为 CTP6,它为我永久修复.
Changed CTP5 (which did fix it for a short while) to CTP6, which fixes it permanently for me.
这篇关于Visual Studio 2015 预览版打破了 SQL Server 层次结构 ID的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!