Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

parameter output does not work?

Status
Not open for further replies.

fayevalentine

Programmer
Jun 2, 2004
38
MX
Hi!
I have a few problems about a stored procedure.
I would thanks all help possible.

Im trying to get the sum of all elements of a column but a get this error:

"Eror 170:Incorrect sintax near ="

This is my code:

CREATE PROCEDURE dbo.Moon
@pintOrderId INT,
@pcurTotal MONEY OUTPUT
AS
SELECT ord.OrderID,
ord.ProductID,
pro.ProductName,
ord.UnitPrice,
ord.Quantity,
Total = ord.UnitPrice * ord.Quantity
-- suma = SUM (ord.UnitPrice * ord.Quantity)
FROM [Order Details] ord LEFT JOIN Products pro ON pro.ProductID LIKE ord.ProductID
WHERE ord.OrderID = @pintOrderId
GROUP BY ord.OrderID,
ord.ProductID,
pro.ProductName,
ord.UnitPrice,
ord.Quantity
SET suma = COMPUTE SUM ( ord.UnitPrice * ord.Quantity )
GO
 
You need to declare @suma as a variable, and change set suma to set @suma. All variables in SQL Server start with @.

Denny
MCSA (2003) / MCDBA (SQL 2000)

--Anything is possible. All it takes is a little research. (Me)

[noevil]
(Not quite so old any more.)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top