How to stop SQLServer writing extraneous stuff eg (1 rows affected)

Solution 1:

Use:

SET NOCOUNT ON

to suppress these messages and use the command below to enable the messages.

SET NOCOUNT OFF

Solution 2:

run this command:

set nocount on