Solved

could n't create a stored procedure?

Posted on 2011-02-23
3
318 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

Forrester Webinar: xMatters Delivers 261% ROI

Guest speaker Dean Davison, Forrester Principal Consultant, explains how a Fortune 500 communication company using xMatters found these results: Achieved a 261% ROI, Experienced $753,280 in net present value benefits over 3 years and Reduced MTTR by 91% for tier 1 incidents.

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…
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 …
Exchange organizations may use the Journaling Agent of the Transport Service to archive messages going through Exchange. However, if the Transport Service is integrated with some email content management application (such as an antispam), the admini…
Attackers love to prey on accounts that have privileges. Reducing privileged accounts and protecting privileged accounts therefore is paramount. Users, groups, and service accounts need to be protected to help protect the entire Active Directory …

733 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