Inspired by this question where there are differing views on SET NOCOUNT...
Should we use SET NOCOUNT ON for SQL Server? If not, why not?
SET NOCOUNT ON even does allows to access to the affected rows like this:
SET NOCOUNT ON
DECLARE @test TABLE (ID int)
INSERT INTO @test
VALUES (1),(2),(3)
DECLARE @affectedRows int = -99
DELETE top (1)
FROM @test
SET @affectedRows = @@rowcount
SELECT @affectedRows as affectedRows
Results
affectedRows
1
Messages
Commands completed successfully.
Completion time: 2020-06-18T16:20:16.9686874+02:00