----------------------------------------------------------- New Message on BDOTNET
----------------------------------------------------------- From: VaibhavModak Message 3 in Discussion Hi Jay, You can nest stored procedures up to 32 levels. The nesting level increases by one when the called stored procedure begins execution and decreases by one when the called stored procedure completes execution. The current nesting level for the stored procedures in execution is stored in the @@NESTLEVEL function. Example of Nested SPs and @@NESTLEVEL CREATE PROCEDURE innerproc as select @@NESTLEVEL AS 'Inner Level' GO CREATE PROCEDURE outerproc as select @@NESTLEVEL AS 'Outer Level' EXEC innerproc GO EXECUTE outerproc GO Here is the result set: Outer Level ----------------- 1 Inner Level ----------------- 2 --- A UDF is also restricted to 32 levels of nesting. Example of Nested UDF Create function factRec(@n int) Returns int Begin If @n=0 Return 1 Return (@n * dbo.factRec(@n-1)) End --- HTH, Regards, Vaibhav Modak ----------------------------------------------------------- To stop getting this e-mail, or change how often it arrives, go to your E-mail Settings. http://groups.msn.com/bdotnet/_emailsettings.msnw Need help? If you've forgotten your password, please go to Passport Member Services. http://groups.msn.com/_passportredir.msnw?ppmprop=help For other questions or feedback, go to our Contact Us page. http://groups.msn.com/contact If you do not want to receive future e-mail from this MSN group, or if you received this message by mistake, please click the "Remove" link below. On the pre-addressed e-mail message that opens, simply click "Send". Your e-mail address will be deleted from this group's mailing list. mailto:[EMAIL PROTECTED]
