SQL 2005 Express, Upated and set

  • When I try to ALTER the storproc I get the above error!

    PLEASE HELP ME.

    The problem is the adding of the two columns then updating the first one, which is the best way to do this?

    ALTER PROCEDURE [dbo].[InsertMachineTestingA]

    @MachModelID int,

    @MachSerialNo nvarchar (50),

    @MachCustomerID int = 1,

    @MachComments nvarchar (100)= NULL

    AS

    INSERT INTO Machines (MachModelID, MachSerialNo, MachCustomerID, MachComments)

    VALUES (@MachModelID, @MachSerialNo, @MachCustomerID, @MachComments)

    UPDATE dbo.Parts

    SET dbo.Parts.PartUnitsOnHand = sum(dbo.Parts.PartUnitsOnHand+dbo.ModelTemplates.ModTempPartUnits)

    FROM dbo.Parts INNER JOIN dbo.ModelTemplates

    ON dbo.Parts.PartID = dbo.ModelTemplates.ModTempPartID

    WHERE (dbo.ModelTemplates.ModTempModelID = @MachModelID)

    Thanks in advance

  • Where is the above error?

  • You cannot have an aggregate in a set list of the update

Viewing 3 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic. Login to reply