SQL Sage Road Note--sql storage process Optimization Nocount

Source: Internet
Author: User

In the stored procedure, the set NOCOUNT on is often used;

Effect: Prevents the return of row count information in the result set that is displayed by T-SQL statements or by USP.
When set Oncount on, the count is not returned, when set NOCOUNT off, the count is returned;

Update @ @RowCount Even when set NOCOUNT on;

When set NOCOUNT on, the DONE_IN_PROC message for each statement of the stored procedure will not be sent to the client, and if the stored procedure contains statements that do not return actual data, network traffic will be greatly reduced, which can significantly improve application performance;

Set NOCOUNT the specified setting takes effect during execution or runtime and does not take effect when parsing.

1 ///when there is too much data, using NOCOUNT can not return the number of rows affected, for optimization purposes:2 3 SetNOCOUNT on;4 5 INSERT  intoPrc_xoem_stor_sr_data_raw (STOR_ID,SLSPRS_ID,SLSPRS_NM,LST_UPT_DTM)6 Select'7836','20438','Test','2016-05-03'UNION  All7 Select'96558','20438','Test','2016-05-03'UNION  All8 Select'101377','20438','Test','2016-05-03'UNION  All9 .Ten . One . A Select'101431','20438',"','2016-05-03'UNION  All - Select'101573','20438',"','2016-05-03'  - SetNOCOUNTOFF 

SQL Sage Road Note--sql storage process Optimization Nocount

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.