Pages

Search This Blog

Monday, February 1, 2010

[T-SQL] Recursive CTE Contd...

Using recursive CTE normally if level exceeds 100 then it will give statement
"The statement terminated. The maximum recursion 100 has been exhausted before statement completion"

So change the below line


SELECT @PARENT_ID=Min(COALESCE(PARENTPRODUCTGROUP_ID,ID)) FROM RECURSIVECTE option (maxrecursion 32767) ;

No comments: