SET NOCOUNT ON usage

前端 未结 17 1943
抹茶落季
抹茶落季 2020-11-22 05:55

Inspired by this question where there are differing views on SET NOCOUNT...

Should we use SET NOCOUNT ON for SQL Server? If not, why not?

17条回答
  •  情话喂你
    2020-11-22 06:16

    I don't know how to test SET NOCOUNT ON between client and SQL, so I tested a similar behavior for other SET command "SET TRANSACTION ISOLATION LEVEL READ UNCIMMITTED"

    I sent a command from my connection changing the default behavior of SQL (READ COMMITTED), and it was changed for the next commands. When I changed the ISOLATION level inside a stored procedure, it didn't change the connection behavior for the next command.

    Current conclusion,

    1. Changing settings inside stored procedure doesn't change the connection default settings.
    2. Changing setting by sending commands using the ADOCOnnection changes the default behavior.

    I think this is relevant to other SET command such like "SET NOCOUNT ON"

提交回复
热议问题