如何在SQL Server数据库中向hierarchyid数据类型插入空值?

时间:2016-05-23 03:04:41

标签: sql sql-server sql-server-2012

我试图在table1中插入包含数据类型'''hierarchyid'列的空值,这使我产生了以下错误。

A .NET Framework error occurred during execution of user-defined routine or aggregate "hierarchyid": 
Microsoft.SqlServer.Types.HierarchyIdException: 24001: SqlHierarchyId.Parse failed because the input string 'NULL' is not a valid string representation of a SqlHierarchyId node.
Microsoft.SqlServer.Types.HierarchyIdException: at Microsoft.SqlServer.Types.SqlHierarchyId.Parse(SqlString input)

是否可以向此列插入空值,还是有其他方法可以执行此操作?

1 个答案:

答案 0 :(得分:1)

我认为您要将DBNull.Value插入列中,而不是字符串“null”。