I am trying to run the following query and it keeps telling me that zcomp is not a valid column name. zcomp is supposed to be the variable I am using to tell it which ComponentID I wish to update. It works fine if I put a value in place of zcomp, like 3089 - the ComponentID is and Integer, PK and Auto-increment. But it won't take the variable. Do I need to do something special to use the variable in place of the actual number?
Thanks,
Stacy
USE [MT]
GO
/****** Object: StoredProcedure [dbo].[MaxDatePart] Script Date: 11/06/2012 11:47:22 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE PROC [dbo].[WOPartsUpdate]
(
@zamnt Integer,
@zcomp Integer
)
AS
BEGIN
SET NOCOUNT ON
UPDATE dbo.sparts
SET dbo.sparts.QtyonHand = dbo.sparts.QtyonHand + zamnt WHERE ComponentID=zcomp;
END