Natural recursion of SQL Server Stored Procedures

Source: Internet
Author: User

Several times, when I write or modify a stored procedure, for the convenience of the graph, write the statement to execute the stored procedure at the end, such

Alter procedure prd_getdata @ top Int = 10; asselect * from [DBO]. Table1 order by id desc; endexec [DBO]. prd_getdata

You should have selected the last row with the mouse and specified it for execution. However, at the moment, the system trembled and pressed it to run without being selected. Many results were returned. At last, the system warned too many layers and the SQL statement exited automatically.

The reason is that the system

Exec [DBO]. prd_getdata

This statement is also used as a statement of the stored procedure itself to form recursion, so there is an infinite loop.

Stored Procedure

Tune up one hundred and eighty turtles

Related Article

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.