[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1080
  • Last Modified:

could not find stored procedure error

I have created a stored procedure as below

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

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

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?

0
martin05
Asked:
martin05
  • 2
1 Solution
 
rafranciscoCommented:
Try this:

EXEC dbo.dt_update_lastFSRnum_bycallnum 10046, 1
0
 
martin05Author Commented:
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.
0
 
HilaireCommented:
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)
as
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
0
 
rafranciscoCommented:
Did you include the dbo in the stored procedure like this?

EXEC dbo.dt_update_lastFSRnum_bycallnum 10046, 1
0

Featured Post

Efficient way to get backups off site to Azure

This user guide provides instructions on how to deploy and configure both a StoneFly Scale Out NAS Enterprise Cloud Drive virtual machine and Veeam Cloud Connect in the Microsoft Azure Cloud.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now