Is there a command I can run inside my SQL script so that it stops outputing information about each operation that gets run?
ie I don't want to see this:
(1 row(s) affected)
(1 row(s) affected)
(1 row(s) affected)
If you do not want to know how many rows were impacted by your SQL Statement, it is a good idea to use SETNOCOUNT ON and turn off the message. In simple words, if you do not need to know how many rows are affected, SET NOCOUNT ON as it will reduce network traffic leading to better performance.
When a trigger exists on a table being inserted or updated, the return value includes the number of rows affected by both the insert or update operation and the number of rows affected by the trigger or triggers. For all other types of statements, the return value is -1.
If you want to suppress this message, then you can use the “SET NOCOUNT” statement.
If you don't need to omit any rows, you can use SQL Server's TOP clause to limit the rows returned. It is placed immediately after SELECT. The TOP keyword is followed by integer indicating the number of rows to return. In our example, we ordered by price and then limited the returned rows to 3.
Use:
SET NOCOUNT ON
to suppress these messages and use the command below to enable the messages.
SET NOCOUNT OFF
run this command:
set nocount on
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With