开发者

Simple Stored Procedure Question

I am creating a simple stored procedure in VS 2010/SQL Server 2008 as follows:

CREATE PROCEDURE ReturnPrice @carID int @price decimal(18,2) output AS SELECT @price = Price FROM Cars WHERE Ca开发者_C百科rID = @carID

and I am receiving the following error message when attempting to save:

Incorrect syntax near '@price' Must declare the scalar variable "@price"

Any pointers or tips as to where I am going wrong will be much appreciated.

Thank you.


You need to separate your parameters with commas!

CREATE PROCEDURE ReturnPrice 
   @carID int,
   @price decimal(18,2) output 
AS 
   SELECT 
      @price = Price 
   FROM 
      dbo.Cars 
   WHERE 
      CarID = @carID 


Never mind i realised it was a simple syntax error, missing a comma!!!

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜