This article is a mirror article of machine translation, please click here to jump to the original article.

View: 4153|Reply: 0

[Source] Performance optimization: SQL Server shuts down the output of the affected number of rows

[Copy link]
Posted on 9/21/2022 6:59:42 PM | | | |
When executing a SQL script in the SQL Server database, the SQL script updates the data in a loop, and the data volume is relatively large, and the execution result will output a large amount of information affecting the number of rows, as shown in the figure below:



How do I turn off the output of affected rows? Enter on the first line of the scriptSET NOCOUNT ON, measured the execution scriptThe speed is much faster, saving half a minute of time

SET NOCOUNT

Causes the returned results to contain no information about the number of rows affected by the Transact-SQL statement.

grammar

SET NOCOUNT { ON | OFF }

exegesis

When SET NOCOUNTWhen ON, no count is returned(indicates the number of lines affected by the Transact-SQL statement). When SET NOCOUNT is OFF, the count is returned.

scope

set nocountThe scope is the current session, which means that it will remain active as long as the session does not turn off the nocount setting.

Reference Documentation:The hyperlink login is visible.





Previous:Player Cloud cannot add a download resource solution to the cloud
Next:20 new APIs for .NET 6
Disclaimer:
All software, programming materials or articles published by Code Farmer Network are only for learning and research purposes; The above content shall not be used for commercial or illegal purposes, otherwise, users shall bear all consequences. The information on this site comes from the Internet, and copyright disputes have nothing to do with this site. You must completely delete the above content from your computer within 24 hours of downloading. If you like the program, please support genuine software, purchase registration, and get better genuine services. If there is any infringement, please contact us by email.

Mail To:help@itsvse.com