我在数据库testtable中创建了一个表testbase,其结构如下:
product_no (int, not null)
product_name (varchar(30), not null)
price (money, null)
expire_date (date, null)
expire_time (time(7), null)我使用了MicrosoftSQLServer2008ManagementStudio。
我创建了存储过程testtable_pricesmaller,如下所示
use testbase
go
create procedure testtable_pricesmaller
@pricelimit money
as
select * from testtable where price = @pricelimit;
go并且能够查看的Object Explorer上的存储过程。(它列在Object Explorer的以下树结构中)
Databases
+ testbase
+ Tables
+ dbo.testtable
+ Programmability
+ Stored Procedures
+ dbo.testtable_pricesmaller当我收到以下错误时,我觉得很奇怪:
Could not find the stored procedure 'dbo.testtable_pricesmaller'.执行以下SQL语句时:
execute dbo.testtable_pricesmaller 50它可能少了什么?
发布于 2012-09-10 05:45:26
最后,我知道了消息出现在中的原因。
在创建存储过程后需要重新启动它。
在重新启动之后,不再存在此类错误。
(奇怪的是,这是否意味着每次创建存储过程时都必须重新启动它?)
发布于 2015-04-18 21:58:29

IntelliSense刷新本地缓存应该修复它
发布于 2012-09-10 15:44:11
添加新的存储过程后,不应该重新启动数据库,尽管您需要刷新对象资源管理器才能在那里看到它。
下次添加存储过程时,请尝试运行“对象资源管理器”中的“执行”选项,然后输入参数并查看其是否运行。如果它不运行,那么我不知道你的问题是什么。如果它确实运行,那么它可能是一些简单的东西,比如SQL试图从错误的数据库进行查询。
https://dba.stackexchange.com/questions/23983
复制相似问题