473,405 Members | 2,262 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,405 software developers and data experts.

recursive call in stored proc

Hi all

I am implementing a stored procedure which needs to recursively call
itself until specific condition is reached, Could anyone give some
advice about that?

Thanks a lot

Robert Song
Jul 20 '05 #1
3 6128
"Robert Song" <ro*********@mda-software.com> wrote in message
news:fb**************************@posting.google.c om...
Hi all

I am implementing a stored procedure which needs to recursively call
itself until specific condition is reached, Could anyone give some
advice about that?

Thanks a lot

Robert Song


One caveat is that the limit to the number of recursive calls to a procedure
is 32, that is, the count of the initial call and the subsequent recursive calls
must not be greater than 32. If you can't guarantee respecting this upper bound,
iteration might be the way to go. Even if you can, iteration might still be more
efficient than recursion. However, if you can guarantee not exceeding the
magic number 32 and the procedure is more clear recursively than
iteratively, then I'd go that way.

--
JAG
Jul 20 '05 #2
Hi John,

Thank you John, I'v got it.

Any way the reason I post this issue is: previously when i debugged
the SP of recursive call in Sql Query Analyzer I used the F10(step
over) key and it did't work. Today after read your respone, i feel
confident to debug it again. I used the key of F11(Step in) , It
works!

Thank you.

Robert Song
Jul 20 '05 #3
>> I am implementing a stored procedure which needs to recursively
call itself until specific condition is reached, Could anyone give
some advice about that? <<

Not without seeing the code first :) This request is so vague, I am
tempted to reply with "Fire good! Poison bad!"

Generally speaking, T-SQL is not a good programming language, so you
should never write anything complicated in it. Are you using
recursion because the table design is wrong? I am always scared when
someone asks for how to implement a solution they have already decided
on; the right way to ask for help is to state the problem first.
Example: "what is the best kind rock for smashing screws into wood?"
The question excludes "use a screwdriver" and seeks the simple answer
"Granite!"
Jul 20 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: Jean-Marc Blaise | last post by:
Dear all, I have simulated the windows MULTI application with a java program calling the SQLTP1DL proc referenced as DB2DARI application, on Linux Intel or ZLinux. If the proc is NOT FENCED,...
0
by: Dave Sisk | last post by:
I've created a system or external trigger on an AS/400 file a.k.a DB2 table. (Note this is an external trigger defined with the ADDPFTRG CL command, not a SQL trigger defined with the CREATE...
3
by: Mo | last post by:
Hi, I have a webform which has vb.net code behind it and I would like it to submit the entries in the fields into a sql server db using a stored procedure. I have a central .vb file in my...
14
by: Roy | last post by:
Apologies for the cross-post, but this truly is a two-sided question. Given the option of creating Looping statements within a stored proc of sql server or in the code-behind of an .net webpage,...
0
by: rsstonejr | last post by:
Hello. Has anybody ever called a stored proc on a SQL Server 2005 database from a SQL Server 2000 database? Is it even possible? I'm using the following command: ...
3
by: mandible | last post by:
I'm trying to call one stored procedure inside another. I was wondering if this is possible Some ideas I was toying with is putting the first stored procedure inside of a temp table but haven't...
3
by: oregondba | last post by:
I have a database I have inherited (new job). I am trying to baseline the code and have done a DB2Look to get the code out of an existing db. The DB2Look produced a SP with the following form: ...
0
by: skchonghk | last post by:
As title. Is it possible? Thanks. Adrian
2
by: =?Utf-8?B?Vmlua2k=?= | last post by:
Hello Everyone, I can successfully insert and update the oracle database by calling a oracles stored proc from my .net code. This oracle stored proc is returning some value. I cannot see that...
1
by: Roger Barney | last post by:
I have a need to run a recursive CTE within a stored proc, but I can't get it past this: SQL0104N An unexpected token "with" was found following "SET count=count+1; ". Expected tokens may include:...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.