問題描述
安裝 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的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!