【问题标题】:isDescendantOf method can not be found in SQL Server 2012 script - Why?在 SQL Server 2012 脚本中找不到 isDescendantOf 方法 - 为什么?
【发布时间】:2015-03-30 20:42:31
【问题描述】:

我是 SQL Server 2012 的新手,在我运行这段代码之前做得很好,这段代码取自 Microsoft 书籍。我一直在寻找解决方案,但无处可寻。

非常感谢您提供的任何建议。

DECLARE @AmyNodeId hierarchyid

SELECT @AmyNodeId = NodeId
 FROM  Employee
 WHERE EmployeeId = 46

SELECT NodeId.ToString() AS NodeIdPath, *
 FROM  Employee
 WHERE Employee.NodeId.isDescendantOf(@AmyNodeId) = 1
 ORDER BY NodeLevel, NodeId

给出这个消息:

在程序集“Microsoft.SqlServer.Types”中找不到类型“Microsoft.SqlServer.Types.SqlHierarchyId”的方法“isDescendantOf”

哼!

哈维

【问题讨论】:

  • 我遇到了同样的问题。原来isDescendantOf 区分大小写

标签: sql-server-2012


【解决方案1】:

这是因为该方法实际上是区分大小写的!检查你的情况

【讨论】:

    【解决方案2】:

    这在我重新启动 SQL Server 2014 Management Studio 后自行修复。

    混蛋!

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2017-06-15
      • 1970-01-01
      • 2023-03-14
      • 1970-01-01
      • 1970-01-01
      • 2022-06-14
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多