Solved

Couldn't find stored procedure 'file name'

Posted on 2011-02-23
11
400 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
Migrating Your Company's PCs

To keep pace with competitors, businesses must keep employees productive, and that means providing them with the latest technology. This document provides the tips and tricks you need to help you migrate an outdated PC fleet to new desktops, laptops, and tablets.

 
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

NFR key for Veeam Backup for Microsoft Office 365

Veeam is happy to provide a free NFR license (for 1 year, up to 10 users). This license allows for the non‑production use of Veeam Backup for Microsoft Office 365 in your home lab without any feature limitations.

Question has a verified solution.

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

This is basically a blog post I wrote recently. I've found that SARGability is poorly understood, and since many people don't read blogs, I figured I'd post it here as an article. SARGable is an adjective in SQL that means that an item can be fou…
Use this article to create a batch file to backup a Microsoft SQL Server database to a Windows folder.  The folder can be on the local hard drive or on a network share.  This batch file will query the SQL server to get the current date & time and wi…
Are you ready to implement Active Directory best practices without reading 300+ pages? You're in luck. In this webinar hosted by Skyport Systems, you gain insight into Microsoft's latest comprehensive guide, with tips on the best and easiest way…

738 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