Click to See Complete Forum and Search --> : nested recursion(a procedure which calls itself)


danpanex
04-13-2006, 02:28 PM
Hello Everyone... :)

How r u guys doing?

I am working in a stored procedure(using SQL sever), which has to call itself, for example:

Create Procedure Example

@Parameter1 int
@Parameter2 int

AS

DECLARE @Var1 int

SET @Var1=@Parameter1-@Parameter2

if @Var1 = 0
Execute Example @Var1,@Parameter2

GO

The example above didn't work...of course!

But, Is it possible to do?

If yes, how can i do that?

Any help will be greatly appreciated!!!

Thx in advance!

Daniel

russell
04-19-2006, 04:03 PM
You are referring to recursion, and yes, mssql 2000 supports it.

See This Example (http://www.awprofessional.com/articles/article.asp?p=25288&seqNum=13) on how to do it. You can probably Google a few others out as well.

danpanex
04-19-2006, 06:13 PM
Thank you, Russell!

I've really appreciated that!