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
 General SQL Server Forums
 New to SQL Server Administration
 Defining local procedure

Author  Topic 

ozSQLServer
Starting Member

32 Posts

Posted - 2011-12-21 : 23:53:40
Hi,

Simple question about T-SQL:
"Can I define a proceudre B in procedure A?"
so that procedure B can only be called by the code in procedure A.

Cheers,
ozSQL

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2011-12-22 : 04:17:05
nope. you cant nest procedure definitions like that.
But you can grant the execution rights to only one of user (maybe a dummy one you create) and associate the other procedure to be executed on context of created user. I think that will provide you with closest alternative for above scenario

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

Go to Top of Page

ozSQLServer
Starting Member

32 Posts

Posted - 2011-12-22 : 17:14:17
Thank you.


Cheers,
ozSQL
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2011-12-23 : 01:33:14
wc

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

Go to Top of Page

Sandeep2taurus
Starting Member

1 Post

Posted - 2011-12-27 : 00:04:40
I think we can nest procedures. Check this
http://msdn.microsoft.com/en-us/library/ms190607.aspx

correct me if I am wrong
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2011-12-27 : 02:55:34
quote:
Originally posted by Sandeep2taurus

I think we can nest procedures. Check this
http://msdn.microsoft.com/en-us/library/ms190607.aspx

correct me if I am wrong


nope..OP is not asking on this

You can nest stored procedure calls

but you cant nest stored procedure definitions ie creating one procedure inside another procedure.

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

Go to Top of Page
   

- Advertisement -