views:

35

answers:

2

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 CarID = @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.

+1  A: 

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

Terry
In the future please write that as a comment to the answer you`re refering to and accept the answer
tombom
+7  A: 

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 
marc_s