Avatar of Charles Baldo
Charles Baldo
Flag for United States of America asked on

Stored Procedure needs owner to execute

Working is SQL server 2005 using SSMS 16

I have a stored procedure in a database  exec get_info 'ID175143'

Msg 2812, Level 16, State 62, Line 22
Could not find stored procedure 'get_info'.
 So I do     exec [WorkDatabase].[owner].get_info 'ID175143'

This would be okay but many of the sp's call other sp's so I get these kind of errors

Msg 2812, Level 16, State 62, Procedure get_info, Line 9 [Batch Start Line 19]
Could not find stored procedure 'get_info_base'.

How can I get around this??
Microsoft SQL ServerMicrosoft SQL Server 2005

Avatar of undefined
Last Comment
Charles Baldo

8/22/2022 - Mon
Vitor Montalvão

You should run under the database context. For that you have the USE command to switch to the correct database:
USE [WorkDatabase]

EXEC get_info 'ID175143' 

Open in new window

Charles Baldo

ASKER
Thank You Vitor, but I tried that first and no success, this should be simple I agree
ASKER CERTIFIED SOLUTION
Vitor Montalvão

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
GET A PERSONALIZED SOLUTION
Ask your own question & get feedback from real experts
Find out why thousands trust the EE community with their toughest problems.
ste5an

The owner was replaced by/separated from schema in SQL Server 2005.

As a result of this change, you should use at last always the schema.objectname syntax cause it's faster (name resolution and binding) and the dynamic object binding is normally not used.
I started with Experts Exchange in 2004 and it's been a mainstay of my professional computing life since. It helped me launch a career as a programmer / Oracle data analyst
William Peck
Charles Baldo

ASKER
Thanks Vitor,  

Unfortunate that is the case. I get it now