Link to home
Create AccountLog in
Avatar of Charles Baldo
Charles BaldoFlag 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??
Avatar of Vitor Montalvão
Vitor Montalvão
Flag of Switzerland image

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

Avatar of Charles Baldo

ASKER

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

Link to home
membership
Create an account to see this answer
Signing up is free. No credit card required.
Create Account
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.
Thanks Vitor,  

Unfortunate that is the case. I get it now