Solved

Couldn't find stored procedure 'file name'

Posted on 2011-02-23
11
393 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]
Comment Utility
please show how you try to execute it, and how you created it.
0
 
LVL 32

Expert Comment

by:ewangoya
Comment Utility

Did you create it in the correct database.

try using
execute dbo.myprocedure
0
 
LVL 25

Expert Comment

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

Lee
0
 
LVL 1

Author Comment

by:lucky20
Comment Utility
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
Comment Utility
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
Enabling OSINT in Activity Based Intelligence

Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

 
LVL 32

Expert Comment

by:ewangoya
Comment Utility
Don't click on save

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

Expert Comment

by:Lee Savidge
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
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

Highfive Gives IT Their Time Back

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Audit has been really one of the more interesting, most useful, yet difficult to maintain topics in the history of SQL Server. In earlier versions of SQL people had very few options for auditing in SQL Server. It typically meant using SQL Trace …
SQL Server engine let you use a Windows account or a SQL Server account to connect to a SQL Server instance. This can be configured immediatly during the SQL Server installation or after in the Server Authentication section in the Server properties …
Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…
This video shows how to remove a single email address from the Outlook 2010 Auto Suggestion memory. NOTE: For Outlook 2016 and 2013 perform the exact same steps. Open a new email: Click the New email button in Outlook. Start typing the address: …

762 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

8 Experts available now in Live!

Get 1:1 Help Now