Set nocount {on | off}

Source: Internet
Author: User

The returned results do not contain information about the number of rows affected by the transact-SQL statement.
Syntax: Set nocount {on | off}
The default value is off.

When set nocount is on, no count is returned (indicating the number of rows affected by the transact-SQL statement ).
When set nocount is off, return the count.

Even if set nocount is on, the @ rowcount function is updated.

When set nocount is on, the done_in_proc information of each statement in the stored procedure is not sent to the client. When you use a utility provided by Microsoft SQL server to execute a query) "Nn rows affected" is not displayed in the query results at the end ".

If some statements contained in the stored procedure do not return much actual data, this setting greatly reduces network traffic and significantly improves performance.

Set nocount is set during execution or runtime, rather than during analysis.

Note: When set nocount is on, no count is returned (indicating the number of rows affected by the transact-SQL statement ). When set nocount is off, return the count. ... Conclusion: we should add set nocount on to the header of the stored procedure, and add set nocount off to exit the stored procedure to optimize the process...

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.