could not find stored procedure error

Posted on 2005-04-28
Last Modified: 2012-08-14
I have created a stored procedure as below

create procedure dbo.dt_update_FSRnum_bycallnum(@callnum int, @FSRNum smallint)

      if exists (select * from dbo.numbers
                  where call_num=@callnum)
                  update dbo.numbers set call_last_fsr_num=@FSRNum
                        where call_num=@callnum

Then when in Query Analyser I run

dt_update_lastFSRnum_bycallnum 10046, 1

I receive the following error

Server: Msg 2812, Level 16, State 62, Line 1
Could not find stored procedure 'dt_update_FSRnum_bycallnum'.

Can you please advise where I am going wrong?

Question by:martin05
    LVL 28

    Expert Comment

    Try this:

    EXEC dbo.dt_update_lastFSRnum_bycallnum 10046, 1

    Author Comment

    Just tried EXEC dt_update_lastFSRnum_bycallnum 10046, 1

    However still getting message
    Server: Msg 2812, Level 16, State 62, Line 1
    Could not find stored procedure 'dt_update_lastFSRnum_bycallnum'.

    Please advise.
    LVL 26

    Expert Comment

    First of all you don't need the "if exists" clause
    the SP could write

    create procedure dbo.dt_update_FSRnum_bycallnum(@callnum int, @FSRNum smallint)
    update dbo.numbers set call_last_fsr_num=@FSRNum
    where call_num=@callnum

    as for the "not found" message, please check that you are on the same catalog. Depending on you account settings, query analyser might use the master db by default

    also you prefix the sp name with the owner name

    exec dbo.dt_update_lastFSRnum_bycallnum 10046, 1

    or the fully qualified syntax

    exec mydatabase.dbo.dt_update_lastFSRnum_bycallnum 10046, 1
    LVL 28

    Accepted Solution

    Did you include the dbo in the stored procedure like this?

    EXEC dbo.dt_update_lastFSRnum_bycallnum 10046, 1

    Featured Post

    How to run any project with ease

    Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
    - Combine task lists, docs, spreadsheets, and chat in one
    - View and edit from mobile/offline
    - Cut down on emails

    Join & Write a Comment

    International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
    For both online and offline retail, the cross-channel business is the most recent pattern in the B2C trade space.
    This video shows, step by step, how to configure Oracle Heterogeneous Services via the Generic Gateway Agent in order to make a connection from an Oracle session and access a remote SQL Server database table.
    Using examples as well as descriptions, and references to Books Online, show the documentation available for datatypes, explain the available data types and show how data can be passed into and out of variables.

    733 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    24 Experts available now in Live!

    Get 1:1 Help Now