Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is the advantage of using "Set NOCOUNT ON" in stored procedure's which are used in ssis packages?

While I am going through the performance tuning concepts of SQL Server, I found stored procedure using SET NOCOUNT ON in the initial line and again setting it back to SET NOCOUNT OFF on the final line will help to improve performance.

My question here is: how will that be helpful while using the stored procedure with a SSIS package?

like image 765
N.Dinesh.Reddy Avatar asked Jul 01 '16 12:07

N.Dinesh.Reddy


People also ask

Why do we use set Nocount on in stored procedure?

SET NOCOUNT ON prevents the sending of DONEINPROC messages to the client for each statement in a stored procedure.

What is the advantage of using stored procedure with ADO Net?

One advantage of stored procedures is improved performance. Stored procedures typically execute faster than ordinary SQL statements because the database can create, optimize, and cache a data access plan in advance.

What is set Nocount on in MySQL?

The SET NOCOUNT ON stops the message indicating the number of rows affected by a Transact-SQL statement from being returned as part of the results. MySQL doesn't report the number of rows affected by a query, therefore there's no such function.


1 Answers

SET NOCOUNT ON prevents the sending of DONE_IN_PROC messages to the client for each statement in a stored procedure. For stored procedures that contain several statements that do not return much actual data, or for procedures that contain Transact-SQL loops, setting SET NOCOUNT to ON can provide a significant performance boost, because network traffic is greatly reduced.

Source BOL: SET NOCOUNT

like image 139
Chris Pickford Avatar answered Nov 15 '22 07:11

Chris Pickford