简体   繁体   English

“找不到存储过程 <procedure name> ”

[英]“could not find stored procedure <procedure name>”

I have created a simple procedure that will give me the table entries containing a similar keyword. 我创建了一个简单的过程,该过程将为我提供包含类似关键字的表条目。

Procedure: 程序:

USE ResourceRequest
GO

CREATE PROCEDURE resource_lookup @ProjectName nvarchar(100)=null
AS
SELECT * 
FROM [dbo].Resource_Request
WHERE [Project Name] LIKE @ProjectName + '%'
GO

I can execute the procedure but there appears to be something wrong with "[dbo].[resource_lookup]" because it could not be found? 我可以执行该过程,但是“ [dbo]。[resource_lookup]”似乎有问题,因为找不到它? I'm currently logged into the test server and can see the procedure in the "Stored Procedures" folder? 我当前已登录测试服务器,可以在“存储过程”文件夹中看到该过程吗? What is causing this problem? 是什么导致此问题?

    USE [ResourceRequest]
GO

DECLARE @return_value int

EXEC    @return_value = [dbo].[resource_lookup]
        @ProjectName = N'mutually'

SELECT  'Return Value' = @return_value

GO

You don't specify an explicit schema in the create so it creates it in your default schema which looks like it isn't dbo. 您无需在create指定显式架构,因此它会在您看起来不是dbo的默认架构中创建它。

Use 采用

CREATE PROCEDURE dbo.resource_lookup @ProjectName nvarchar(100)=null
AS
/* ... */

To ensure it is created as desired. 为了确保它是按需创建的。


But it sounds like this is an intellisense warning rather than a runtime error. 但是听起来这是一种智能提示,而不是运行时错误。

So use Ctrl + Shift + R to refresh the intellisense cache so it picks up your newly added object. 因此,使用Ctrl + Shift + R 刷新智能感知缓存,以便它拾取您新添加的对象。

Or if that doesn't work (some SSMS addins hijack this combination) do it through the menu options Edit -> IntelliSense -> Refresh Local Cache 或者,如果这不起作用(某些SSMS插件劫持了这种组合),则可以通过菜单选项“ Edit -> IntelliSense -> Refresh Local Cache

菜单截图

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM