Solved

could n't create a stored procedure?

Posted on 2011-02-23
3
314 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
3 Comments
 
LVL 32

Assisted Solution

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

Three Reasons Why Backup is Strategic

Backup is strategic to your business because your data is strategic to your business. Without backup, your business will fail. This white paper explains why it is vital for you to design and immediately execute a backup strategy to protect 100 percent of your data.

Question has a verified solution.

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

Suggested Solutions

Naughty Me. While I was changing the database name from DB1 to DB_PROD1 (yep it's not real database name ^v^), I changed the database name and notified my application fellows that I did it. They turn on the application, and everything is working. A …
How to leverage one TLS certificate to encrypt Microsoft SQL traffic and Remote Desktop Services, versus creating multiple tickets for the same server.
Nobody understands Phishing better than an anti-spam company. That’s why we are providing Phishing Awareness Training to our customers. According to a report by Verizon, only 3% of targeted users report malicious emails to management. With compan…

832 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