Counting the number of deleted rows in a SQL Server stored procedure

前端 未结 7 1713
借酒劲吻你
借酒劲吻你 2021-02-06 20:26

In SQL Server 2005, is there a way of deleting rows and being told how many were actually deleted?

I could do a select count(*) with the s

7条回答
  •  [愿得一人]
    2021-02-06 21:28

    Just do this:

    SET NOCOUNT off ;
    SELECT @p1 = @@ROWCOUNT
    

    where p1 is the output parameter you set in the stored procedure. Hope it helps.

提交回复
热议问题