Setting NOCOUNT in your Stored Procedures

NOCOUNT is a SQL Server setting that (when activated) will stop SQL Server from returning the “x row(s) affected” message as part of its execution. Although this message is helpful with T-SQL queries in SQL Server Management Studio, it is of little use with Stored Procedures. Enabling this setting will reduce network traffic, and therefore should improve performance.
So, to activate it, just include in the first line of the Stored Procedure SET NOCOUNT ON;

E.g.

CREATE Procedure dbo.spf_GetTaxReturnQuestionByDesign (
    @TaxReturnDesignID INT,
    @TaxYear DATETIME,
    @WebOnly INT = 0
)
AS
BEGIN
    
    SET NOCOUNT ON

For more information, check out these links

As always, I hope that helps someone.

Subscribe

0 comments