?
Solved

Couldn't find stored procedure 'file name'

Posted on 2011-02-23
11
Medium Priority
?
406 Views
Last Modified: 2012-05-11
Hi
I have created a stored procedure  and trying to execute. It is giving me the error as "could n't find stored procedure <my filename>".
all my stored procedures are at programmability->storeprocedure.
But this file is not there.
can any one know about this?
0
Comment
Question by:lucky20
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 3
  • 2
  • +1
11 Comments
 
LVL 143

Expert Comment

by:Guy Hengel [angelIII / a3]
ID: 34962364
please show how you try to execute it, and how you created it.
0
 
LVL 32

Expert Comment

by:Ephraim Wangoya
ID: 34962370

Did you create it in the correct database.

try using
execute dbo.myprocedure
0
 
LVL 25

Expert Comment

by:Lee Savidge
ID: 34962392
Sounds like it has been dropped if you can't see it listed.

Lee
0
Get 15 Days FREE Full-Featured Trial

Benefit from a mission critical IT monitoring with Monitis Premium or get it FREE for your entry level monitoring needs.
-Over 200,000 users
-More than 300,000 websites monitored
-Used in 197 countries
-Recommended by 98% of users

 
LVL 1

Author Comment

by:lucky20
ID: 34962471
set ANSI_NULLS ON
set QUOTED_IDENTIFIER ON
go


-- =============================================
-- Author:		<Author,,Name>
-- Create date: 1/26/2011
-- Description:	<Description,,>
-- =============================================
ALTER PROCEDURE [dbo].[sp_item] 
	-- Add the parameters for the stored procedure here
	
	@oitem varchar(30)
AS
BEGIN
	-- SET NOCOUNT ON added to prevent extra result sets from
	-- interfering with SELECT statements.
	SET NOCOUNT ON;

    -- Insert statements for procedure here
	select itemid,item,Quantity from items where item=@oitem

END

Open in new window


and executed like this

exec dbo.sp_item 'ham'
0
 
LVL 1

Author Comment

by:lucky20
ID: 34962483
If I click on save. It is asking a file name to give. then I gave sp_item .
but when executing getting this error
0
 
LVL 32

Expert Comment

by:Ephraim Wangoya
ID: 34962500
Don't click on save

Click on Execute, that will create the procedure
0
 
LVL 25

Expert Comment

by:Lee Savidge
ID: 34962517
You don't need to save it. You just run it and it will store in the database and run from there.

On a side note, prefixing stored procedures with sp_ is not good practice:

http://sqlserverpedia.com/blog/sql-server-bloggers/stored-procedure-performance-using-%E2%80%9Csp_%E2%80%9D-prefix-%E2%80%93-myth-or-fact/

Lee
0
 
LVL 1

Author Comment

by:lucky20
ID: 34962624
ALTER PROCEDURE [dbo].[sp_item]   
 @oitem varchar(30)  
AS  
BEGIN  
 select itemid,item,Quantity from items where item=@oitem  
  
END
 

Open in new window


and then I used exec dbo.sp_item 'ham'

It is giving an error as invalid object name dbo.sp_item
0
 
LVL 32

Accepted Solution

by:
Ephraim Wangoya earned 2000 total points
ID: 34962655
use create


CREATE PROCEDURE [dbo].[sp_item]  
 @oitem varchar(30)  
AS  
BEGIN  
 select itemid,item,Quantity from items where item=@oitem  

END
0
 
LVL 1

Author Comment

by:lucky20
ID: 34962914
is any thing wrong with this procedure?It is giving lot of errors

CREATE PROCEDURE [dbo].sp_item 
	
@iitemid int
@item varchar(20)
@quantity decimal(10,2)

BEGIN
	
	insert into items(itemid,item,quantity)values(@iitemid,@item,@quantity)
END
GO

Open in new window

0

Featured Post

Back Up Your Microsoft Windows Server®

Back up all your Microsoft Windows Server – on-premises, in remote locations, in private and hybrid clouds. Your entire Windows Server will be backed up in one easy step with patented, block-level disk imaging. We achieve RTOs (recovery time objectives) as low as 15 seconds.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

How to leverage one TLS certificate to encrypt Microsoft SQL traffic and Remote Desktop Services, versus creating multiple tickets for the same server.
In this article we will get to know that how can we recover deleted data if it happens accidently. We really can recover deleted rows if we know the time when data is deleted by using the transaction log.
In this video we outline the Physical Segments view of NetCrunch network monitor. By following this brief how-to video, you will be able to learn how NetCrunch visualizes your network, how granular is the information collected, as well as where to f…
In this video, Percona Solution Engineer Rick Golba discuss how (and why) you implement high availability in a database environment. To discuss how Percona Consulting can help with your design and architecture needs for your database and infrastr…

801 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