Solved

Couldn't find stored procedure 'file name'

Posted on 2011-02-23
11
395 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
  • 4
  • 3
  • 2
  • +1
11 Comments
 
LVL 142

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:ewangoya
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
 
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
VMware Disaster Recovery and Data Protection

In this expert guide, you’ll learn about the components of a Modern Data Center. You will use cases for the value-added capabilities of Veeam®, including combining backup and replication for VMware disaster recovery and using replication for data center migration.

 
LVL 32

Expert Comment

by:ewangoya
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:
ewangoya 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

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.
This article explains how to reset the password of the sa account on a Microsoft SQL Server.  The steps in this article work in SQL 2005, 2008, 2008 R2, 2012, 2014 and 2016.
Hi friends,  in this video  I'll show you how new windows 10 user can learn the using of windows 10. Thank you.
Both in life and business – not all partnerships are created equal. As the demand for cloud services increases, so do the number of self-proclaimed cloud partners. Asking the right questions up front in the partnership, will enable both parties …

867 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

19 Experts available now in Live!

Get 1:1 Help Now