为什么 Hierarchyid SQL 数据类型没有等效项?
据我了解,我们必须将此类型映射为二进制才能在应用程序代码中访问它。 但为什么没有与所有这些类型方法完全等效的方法呢?
我们应该如何在代码中使用? 或者我们根本不应该在 SQL 环境之外使用它?
编辑:这个问题也延伸到地理和几何类型。
I understand it that we have to map this type as binary to get to it in the application code. But why isn't there an exact equivalent with all those type methods?
How are we supposed to work with in the code? Or we aren't supposed to work with it outside SQL environment at all?
EDIT: The question extends to the geography and geometry types as well.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
这是一篇有趣的文章,为 sql server 2008 的 Hierarchyid 提供了很好的指导:
http://vaideeswaranr.blogspot.com/ 2010/01/working-with-hierarchical-data-in-sql.html
也许你可以在那里问你的问题。
Here's an interesting post that provides a good guidance on hierarchyid of sql server 2008:
http://vaideeswaranr.blogspot.com/2010/01/working-with-hierarchical-data-in-sql.html
May be you can ask your question there.
SQL Server 2008 中的所有新类型也可以作为您最喜爱的 CLR 语言中的标准 .NET CLR 类型提供 - 您会发现 SqlHierarchyId、SqlGeometry、SqlGeography、DateTimeOffset,以及所有令人兴奋的新内容。
如果您在计算机上安装 SQL Server 2008,则会安装这些附加程序集,或者您也可以像 Remus 指出的那样,将它们作为 SQL Server 2008 功能包的一部分单独下载并安装。 这些类型可从 Microsoft.SqlServer.Types 命名空间(以相同名称存储在程序集中)获取 - 除了位于基本 System 命名空间中的 DateTimeOffset(使用其他日期类型)。
马克
All the new types in SQL Server 2008 are available as standard .NET CLR types in your favorite CLR language as well - you'll find SqlHierarchyId, SqlGeometry, SqlGeography, DateTimeOffset, all the new exciting stuff.
These additional assemblies are installed if you install SQL Server 2008 on your machine, or you can download and install them separately as Remus pointed out, as part of the SQL Server 2008 Feature Pack. These types are available from the
Microsoft.SqlServer.Types
namespace (stored in the assembly by the same name) - except for the DateTimeOffset which is in the baseSystem
namespace (with the other date types).Marc
新类型的客户端代码由 SQL Server 2008 功能包:
The client code for the new types is installed separately by the SQL Server 2008 Feature Pack: