Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2005 Forums
 Transact-SQL (2005)
 MAXRECURSION Error

Author  Topic 

ravininave
Posting Yak Master

111 Posts

Posted - 2010-02-25 : 08:06:22
This is My Query
ALTER PROCEDURE [dbo].[FindDownline]
(@IBDNO_1 [numeric](9))

As
;with data
as
(
Select IBDNo,SP_IBDNo=IBDNo from IBDDets Where IBDNo=@IBDNo_1
union all
Select s.IBDNo,d.SP_IBDNo FROM IBDDets s INNER JOIN data d ON s.SP_IBDNo=d.IBDNo
)
Select no_downline = count(*) from data where IBDNo<> SP_IBDNo
OPTION (MAXRECURSION 365);

It was running well till Yesterday. Now He is taking long process and even don't complete the query. I tried by changing MaxRecursion up 36000. What's another Solution.

khtan
In (Som, Ni, Yak)

17689 Posts

Posted - 2010-02-25 : 08:10:26
you might have a loop somewhere in the line that is causing it to goes into infinite loop


KH
[spoiler]Time is always against us[/spoiler]

Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2010-02-25 : 09:27:46
can you check if you've any circular references in data?

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/

Go to Top of Page

ravininave
Posting Yak Master

111 Posts

Posted - 2010-02-25 : 11:45:47
Yaa Sorry, there was problem with my data.
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2010-02-25 : 11:50:18
ok..i thought so
anyways glad that you're sorted it out

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/

Go to Top of Page
   

- Advertisement -