Solved

Couldn't find stored procedure 'file name'

Posted on 2011-02-23
11
402 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
What Is Transaction Monitoring and who needs it?

Synthetic Transaction Monitoring that you need for the day to day, which ensures your business website keeps running optimally, and that there is no downtime to impact your customer experience.

 
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 500 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

Transaction Monitoring Vs. Real User Monitoring

Synthetic Transaction Monitoring Vs. Real User Monitoring: When To Use Each Approach? In this article, we will discuss two major monitoring approaches: Synthetic Transaction and Real User Monitoring.

Question has a verified solution.

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

I have written a PowerShell script to "walk" the security structure of each SQL instance to find:         Each Login (Windows or SQL)             * Its Server Roles             * Every database to which the login is mapped             * The associated "Database User" for this …
If you have heard of RFC822 date formats, they can be quite a challenge in SQL Server. RFC822 is an Internet standard format for email message headers, including all dates within those headers. The RFC822 protocols are available in detail at:   ht…
This video Micro Tutorial shows how to password-protect PDF files with free software. Many software products can do this, such as Adobe Acrobat (but not Adobe Reader), Nuance PaperPort, and Nuance Power PDF, but they are not free products. This vide…
In this brief tutorial Pawel from AdRem Software explains how you can quickly find out which services are running on your network, or what are the IP addresses of servers responsible for each service. Software used is freeware NetCrunch Tools (https…

724 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