Sometimes, when working with T-SQL scripts, you might want to skip the message “(N row(s) affected)” message. This article explains how to suppress the “N Row(s) Affected” output message in SQL Server.
You get this message when you execute T-SQL statements or stored procedures that they affect rows. To this end, SQL Server returns the number of records which were affected by the database operation you performed.
The short answer
If you want to suppress this message, then you can use the “SET NOCOUNT” statement.
So, for example you can try something like this:
SET NOCOUNT ON; -- Your query goes here SET NOCOUNT OFF;
Below, you can see an example with screenshots that illustrates the above
|Figure 1: Running a T-SQL Statement with the Default NOCOUNT Setting.|
|Figure 2: Running a T-SQL Statement After Setting NOCOUNT to ON.|
Check our Related SQL Server Development Articles:
- The set identity_insert Command in SQL Server
- The Import Flat File Wizard in SSMS v17.x
- Listing all Tables of a Linked Server’s Database
- How to Import and Export Unstructured Data in SQL Server – FileTables
- How to Import and Export Unstructured Data in SQL Server – FILESTREAM
- How to Import and Export Unstructured Data in SQL Server – The IMAGE Datatype
Featured Database Productivity Tools
Develop T-SQL code faster with Snippets Generator: Create and modify T-SQL snippets for use in SQL Management Studio, fast, easy and efficiently.
Dynamic SQL Generator: Convert static T-SQL code to dynamic and vice versa, easily and fast.
Did you find this article useful and interesting? Feel free to leave your comment!
Subscribe to our newsletter and stay up to date with our latest articles on SQL Server and related technologies!
Check out our latest software releases! All our software tools have free trial versions to download.
Rate this article:
Reference: SQLNetHub.com (https://www.sqlnethub.com)