---
title: "Stored Procedure doesn't exist, or does it?"  
description: "Stored Procedure doesn't exist, or does it?"  
author: "Anonymous User"  
published: 2013-09-04  
updated: 2013-09-04  
canonical: https://www.mindstick.com/forum/1447/stored-procedure-doesn-t-exist-or-does-it  
category: "c#"  
tags: ["c#"]  
reading_time: 2 minutes  

---

# Stored Procedure doesn't exist, or does it?

I have a db [connection](https://www.mindstick.com/articles/13012/what-makes-ethernet-connection-better-than-wifi) where I run [stored procedures](https://www.mindstick.com/forum/540/using-stored-procedures-with-entity-framework-in-an-asp-dot-net-application) on. This same connection is used to create said stored procedures earlier on.

When I attempt to call a given [stored procedure](https://www.mindstick.com/articles/803/using-stored-procedure-in-asp-dot-net), later on, I get the following message:

Could not find stored procedure 'dbo.yaf_prov_upgrade'.

The problem is it actually does exist on the database. And there's also the fact that it [shows up](https://answers.mindstick.com/qa/50405/apple-iphone-x-shows-up-liquid-detected-error-when-charging) on the [SQL Server](https://www.mindstick.com/articles/12999/what-is-table-valued-function-in-sql-server) Profiler.

RPC:Completed exec [dbo].[yaf_prov_upgrade] @PreviousVersion=46,@NewVersion=46 .Net SqlClient [Data Provider](https://www.mindstick.com/forum/34061/unable-to-find-the-requested-dot-net-framework-data-provider-it-may-not-be-installed) Nico Matrix\Nico

I was wondering what could be the causes a particular query would throw such an exception even when it exists, it's called, and the call reaches the database.

It can't be a problem with the connection because it already executed other stored procedures. It can't be a problem with the procedure because it does exist, in fact the very same [application](https://www.mindstick.com/articles/12824/calculator-application-in-android), the very same [web page](https://www.mindstick.com/forum/718/sql-server-report-alignment-to-center-of-web-page), created it and put it there.

Update: forgot to mention I'm used [integrated security](https://www.mindstick.com/forum/159040/what-is-the-difference-between-integrated-security-true-and-integrated-security-sspi), and I did run the SP on the database with the same user the application connects with, and I had no problem running it.

So what can it be?

## Replies

### Reply by Sumit Kesarwani

Hi Ankita,\

Your RPC completed only means that the batch submitted to SQL Server was correct and completed. It doesn't mean the stored procedure ran and executed OK.

It will be (don't argue, check) one of:

wrong permissions

wrong database context

wrong server

stored proc is in a different database

To ensure that things are the same

SELECT

@@SERVERNAME,

SUSER_SNAME(),

DB_NAME(),

USER_NAME(),

OBJECT_ID('dbo.yaf_prov_upgrade')

The OBJECT_ID will be NULL if the stored proc doesn't exist in that database or you don't have permissions.


---

Original Source: https://www.mindstick.com/forum/1447/stored-procedure-doesn-t-exist-or-does-it

Copyright © MindStick Software Pvt. Ltd. This Markdown version is provided for developers, AI systems, and offline reading.
