Solved

could n't create a stored procedure?

Posted on 2011-02-23
3
321 Views
Last Modified: 2012-05-11
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
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
3 Comments
 
LVL 32

Assisted Solution

by:Ephraim Wangoya
Ephraim Wangoya earned 100 total points
ID: 34964762
Modify to

CREATE PROCEDURE [dbo].sp_item  
 (        
@iitemid int,  
@item varchar(20),  
@quantity decimal(10,2)  
 )
 AS
BEGIN  
         
        insert into items(itemid,item,quantity)values(@iitemid,@item,@quantity)  
END
0
 
LVL 26

Assisted Solution

by:tigin44
tigin44 earned 50 total points
ID: 34964769


 CREATE PROCEDURE [dbo].sp_item  
         
@iitemid int,
@item varchar(20),  
@quantity decimal(10,2)
as
 
BEGIN  
         
        insert into items(itemid,item,quantity)values(@iitemid,@item,@quantity)  
END  
GO
0
 
LVL 29

Accepted Solution

by:
Paul Jackson earned 100 total points
ID: 34964774
You need brackets round the parameters and a comma after each one other than the last. Nees the AS keyword, don't really need the begin and end. try :

 CREATE PROCEDURE [dbo].sp_item  
(          
@iitemid int,  
@item varchar(20),  
@quantity decimal(10,2)  
)  
AS  
        insert into items(itemid,item,quantity)values(@iitemid,@item,@quantity)  
GO
0

Featured Post

Ransomware: The New Cyber Threat & How to Stop It

This infographic explains ransomware, type of malware that blocks access to your files or your systems and holds them hostage until a ransom is paid. It also examines the different types of ransomware and explains what you can do to thwart this sinister online threat.  

Question has a verified solution.

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

In SQL Server, when rows are selected from a table, does it retrieve data in the order in which it is inserted?  Many believe this is the case. Let us try to examine for ourselves with an example. To get started, use the following script, wh…
Occasionally there is a need to clean table columns, especially if you have inherited legacy data. There are obviously many ways to accomplish that, including elaborate UPDATE queries with anywhere from one to numerous REPLACE functions (even within…
Monitoring a network: why having a policy is the best policy? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the enormous benefits of having a policy-based approach when monitoring medium and large networks. Software utilized in this v…
Michael from AdRem Software explains how to view the most utilized and worst performing nodes in your network, by accessing the Top Charts view in NetCrunch network monitor (https://www.adremsoft.com/). Top Charts is a view in which you can set seve…

717 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