FAQ Database Discussion Community


DELETE … OUTPUT COUNT(DELETED.*)

sql,sql-server,output-clause
I want to know how many rows were removed in a certain DELETE operation. I took the Microsoft example B which is DELETE Sales.ShoppingCartItem OUTPUT DELETED.* WHERE ShoppingCartID = 20621; and tried to modify it to return only the count of deleted records: DELETE FROM datacache OUTPUT COUNT(DELETED.*) WHERE [email protected]