开发者

SQL 2008 R2 : Could not find stored procedure

开发者 https://www.devze.com 2023-03-17 15:23 出处:网络
I am studying the SQL procedure. I created a procedure and I execute. I was fine... and.it displayed Could not find stored procedure wh开发者_开发技巧en executed \"exec my_procedure\"

I am studying the SQL procedure.

I created a procedure and I execute. I was fine... and. it displayed

Could not find stored procedure wh开发者_开发技巧en executed "exec my_procedure"

I am not really sure the reasons I am getting this error. Did I choose the wrong directory to store the procedure?


You are probably not in the right database within the query window. There should be a dropdown that shows the current database (possibly master). Choose the database you created the stored procedure in and then try again.


Try this:

USE my_database;
EXEC my_procedure;


It tough to tell this could happen for several reasons.

  1. you didn't actually execute the create proc when you thought you were

  2. you accidentally executed drop proc

  3. You're not connected to the right DB when you called exec my_procedure

  4. You're using a different log on and it doesn't have access to the procedure

  5. Its in a different schema than your default schema

You could run this to see if you proc is there at all in a given DB (or drop the where to see them all)

   select * 
   from INFORMATION_SCHEMA.ROUTINES 
   where ROUTINE_NAME = 'my_procedure'

That said saving the Procedure Creation Script has no impact on your ability to execute it


You can find all stored procedures by using the following command

exec my_database.my_schema.my_procedure

if still fail, can you provide us sp create a script?

0

精彩评论

暂无评论...
验证码 换一张
取 消