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
 Other SQL Server Topics (2005)
 Schema Specific Procedure Calls

Author  Topic 

JerinMathew
Starting Member

2 Posts

Posted - 2010-09-07 : 02:50:31
Hi ,

I have two schemas Say S1 and S2 . I have two procedures inside each of this schema say S1.P1 and S1.P2 for S1 and S2.P1 and S2.P2 for S2 . Is it possible to call S1.P2 from S1.P1 ? .

it is possible to do this like EXEC [S1].P2 , but Wat I want to know is to

1) call EXEC statement directly without [S1] prefix and execute the target Procedure which belong to the same schema of the calling Procedure ?. Currently wat I am facing is when I try to call EXEC P1 it looks for Default Schema (dbo.P1) and throwing a "procedure not found" error .

2)Is there a way to get the current schama name where the SP is executing ?

russell
Pyro-ma-ni-yak

5072 Posts

Posted - 2010-09-07 : 08:29:43
you need to prefix it.
Go to Top of Page

MSquared
Yak Posting Veteran

52 Posts

Posted - 2010-09-09 : 12:34:36
the default schema is set at the user level, so it could be different for each user. Did you want to run a different procedure based on schema? If User A connects with a default schema of S1, then by executing P1 it would run S1.P1. Likewise if User B connects with a default schema of S2, then they would run S2.P1 when just running exec P1. Is that what you were looking for?

For Faster results please follow the posting guidelines here

http://weblogs.sqlteam.com/brettk/archive/2005/05/25/5276.aspx
Go to Top of Page
   

- Advertisement -