If I have a stored procedure
schema1.proc1 and it selects from
table1, it correctly selects from
schema1.table1. However, when
proc2, it tries to find and execute
There is no
dbo.proc2 so it returns an error that stored procedure is not found. It never looks for
schema1.proc2 even though
schema1.proc2. However, there is also a
schema2.proc2, but the error returned is just that
proc2 is not found or does not exist.
Is there any way other than making that user's
default schema = schema1 to have the stored procedure execute the procedure from its own schema (i.e. assume
schema1.proc2 should be executed prior to searching for
I know that we could simply preface
schema1 explicitly, but we are trying to avoid having to find all stored procedure calls within the stored procedures to append the schema prefix of the calling procedure to the procedure being called.
I can see from
sys.sysdepends that it correctly links
proc1 to the correct database object
proc2, that is also associated with
schema1, but for some reason it does not seem to look for that
proc2, but instead for
Please let me know if there is some database level setting that I am just missing to tell the compiler which to check first.