我想知道在某个 DELETE 操作中删除了多少行。
我采用了 Microsoft 示例 B,它是
DELETE Sales.ShoppingCartItem
OUTPUT DELETED.*
WHERE ShoppingCartID = 20621;
并尝试对其进行修改以仅返回count
已删除记录的:
DELETE FROM datacache
OUTPUT COUNT(DELETED.*)
WHERE userId=@id
但这会抛出
ExceptionMessage: "Incorrect syntax near '*'."
ExceptionType: "System.Data.SqlClient.SqlException"
Message: "Error"
所以我尝试了
DELETE FROM datacache
OUTPUT COUNT(DELETED)
WHERE userId=@id
抛出
ExceptionMessage: "Invalid column name 'DELETED'."
ExceptionType: "System.Data.SqlClient.SqlException"
Message: "Error"
我错过了什么?