Can I globally "set NOCOUNT ON" in TSQL for a query?

There is a stored procedure that we are trying to improve performance ... at the moment we are looking for non-intrusive “fixes”.

This sproc gets called about 500,000 times a day - and it can call up to 50 other stored procedures below. - DO NOT ASK

Please resist the urge to ask "OMGz why !?" questions - but just answer it if you can :)

Is there a way SET NOCOUNT ONat the top of one sproc and extend it to all sprocs and statements below?

EDIT: Judging by the first two answers below, this leaves me asking ... is there a way to set the “user” option in the connection string or something else so that it works for one “user”? - any such "secret advice" as it would be great.

+5
source share
3 answers

Short answer: no, it is impossible to prohibit. You must directly say:

SET NOCOUNT ON

A global change can be made based on the answer by @ user92546, but I am always a little afraid of global changes. The moment you need it, you understand that global changes have been made ... Be careful :).

+4
source
+2
source

SET NOCOUNT ON . .

+2

All Articles