我只是这样做:

Delete FROM MyTable WHERE ScopeValue = ""
Delete FROM G_Scope WHERE ScopeValue is ''
Delete FROM G_Scope WHERE ScopeValue = empty
Delete FROM G_Scope WHERE ScopeValue is empty


我想删除xmlValue字段(不可为空)中的所有行,其中ScopeValue列具有空条目表示零个字符。

有谁知道?

最佳答案

试试这个:

 DELETE FROM dbo.G_Scope WHERE ScopeValue IS NULL


如果不包含任何值,则SQL Server列将为NULL

另一种可能性是XML不是NULL,而是包含一个空字符串作为其值。为此,请使用以下命令:

-- The DATALENGTH of an empty XML column is 5
SELECT * FROM dbo.G_Scope WHERE DATALENGTH(ScopeValue) = 5


那会显示您感兴趣的行吗?

07-24 22:31