开发者

Simple Stored Procedure Question

开发者 https://www.devze.com 2023-01-18 13:51 出处:网络
I am creating a simple stored procedure in VS 2010/SQL Server 2008 as follows: CREATE PROCEDURE ReturnPrice

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

精彩评论

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