存储过程不存在,或者不是吗? [英] Stored Procedure doesn't exist, or does it?

查看:226
本文介绍了存储过程不存在,或者不是吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个问题:

我有我的地方上运行的存储过程的数据库连接。这种相同的连接用于在创建所存储的过程前面

I have a db connection where I run stored procedures on. This same connection is used to create said stored procedures earlier on.

当我尝试调用给定存储过程,后来​​,我得到以下信息:

When I attempt to call a given stored procedure, later on, I get the following message:

找不到存储过程
'dbo.yaf_prov_upgrade'。

Could not find stored procedure 'dbo.yaf_prov_upgrade'.

问题是,它实际上并在数据库中存在。 。还有还有,它表明了对SQL Server Profiler中的事实。

The problem is it actually does exist on the database. And there's also the fact that it shows up on the SQL Server Profiler.

RPC:已完成EXEC
[DBO] [ yaf_prov_upgrade]
@ PreviousVersion = 46,@静态网页= 46的.Net
SqlClient数据
提供商尼科Matrix\Nico

RPC:Completed exec [dbo].[yaf_prov_upgrade] @PreviousVersion=46,@NewVersion=46 .Net SqlClient Data Provider 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, the very same web page, created it and put it there.

更新:忘了提,我用集成的安全,我也运行与应用程序连接时使用的相同用户对数据库的SP,和我没有问题,运行它。

Update: forgot to mention I'm used integrated security, 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?

推荐答案

您RPC只完成指到SQL Server是正确的完成。 ,这并不意味着该存储过程运行并执行确定

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')

该OBJECT_ID将是NULL,如果存储过程不存在的在该数据库中的,或者您没有权限。

The OBJECT_ID will be NULL if the stored proc doesn't exist in that database or you don't have permissions.

这篇关于存储过程不存在,或者不是吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆