HiveBrain v1.2.0
Get Started
← Back to all entries
patternMinor

"Could not find stored procedure' even though the stored procedure have been created in MS SQL Server Management Studio

Submitted by: @import:stackexchange-dba··
0
Viewed 0 times
storedstudiothoughthecreatedsqlcouldprocedurebeenmanagement

Problem

I have created a table testtable inside the database testbase that have the following structure:

product_no (int, not null)
product_name (varchar(30), not null)
price (money, null)
expire_date (date, null)
expire_time (time(7), null)


which I used the Microsoft SQL Server 2008 Management Studio.

I created a stored procedure testtable_pricesmaller as follows

use testbase
go
create procedure testtable_pricesmaller
    @pricelimit money
as
select * from testtable where price = @pricelimit;
go


and are able to view the Stored Procedures on the Object Explorer of the Microsoft SQL Server Management Studio. (It is listed in the following tree structure of the Object Explorer)

Databases
    + testbase
        + Tables
            + dbo.testtable
        + Programmability
            + Stored Procedures
                + dbo.testtable_pricesmaller


I find it very strange when I receive the following error:

Could not find the stored procedure 'dbo.testtable_pricesmaller'.


when I execute the following SQL statement:

execute dbo.testtable_pricesmaller 50


What could it be missing?

Solution

You should not have to restart the database after adding a new stored procedure, although you will need to refresh your object explorer to see it there.

The next time you add a stored procedure try running the right click execute option from the object explorer and enter your parameters and see if it runs. If it does not run then I'm not sure what your problem is. If it does run then it could be something simple like SQL is trying to query from the wrong database.

Context

StackExchange Database Administrators Q#23983, answer score: 7

Revisions (0)

No revisions yet.