Home > SQL Server > Stop showing row count information for the current session – SET NOCOUNT – SQL Server

Stop showing row count information for the current session – SET NOCOUNT – SQL Server


SET NOCOUNT: This set statement tells SQL Server to show or hide the number of row affected by the transact SQL or stored procedure or any other statement that returns rows affected by the last executed SQL statement. But, It does not prevent updating the @@ROWCOUNT statement.

usage:

SET NOCOUNT ON
or
SET NOCOUNT OFF
 

Example

1. when NOCOUNT is off, SQL Server will return the number of rows affected by the last executed query.

pic12. when NOCOUNT is ON, it will not return the number of rows affected value.

pic2Nocount set statement can boost the performance of our application by eliminating the unwanted communication and data sending to the client. In this scenario, SQL Server does not send the message with rows affected by the last executed statement. So, it helps reduces network traffic in transaction processing system or an application with lots of client request.

Advertisements
  1. No comments yet.
  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: