QUERY HINT MAXRECURSION <integer_value>
Specifies the maximum number of recursions allowed for this query.
What changes
- Input
- none
- Output or change
- none
Syntax at a glance
OPTION ( MAXRECURSION <integer_value> )
Work example
A recursive query needs a finite guard while its termination rule is being checked.
Use a small explicit limit in a bounded test. Prove the recursive member stops before increasing the limit.
Check your work QUERY HINT MAXRECURSION <integer_value>. The recursion returns the expected levels and stops below the selected limit.
Open Microsoft Learn for full syntax, permissions, and details for your version.