error in stored procedure 'x' not permitted int his context
error : The name "EmpBenefitDeductID" is not permitted in this context. Valid expressions are constants, constant expressions, and (in some contexts) variables. Column names are not permitted.
CREATE PROCEDURE InsertEmployeeBenefitsDeducts
(
@BranchID bigint,
@EmployeeID bigint,
@BenefitDeductionID bigint,
@AffectOnLeave bit,
@Amount decimal(18,4),
@CreatedUserID bigint,
@CreatedDate datetime,
@ModifiedUserID bigint,
@ModifiedDate datetime
)
AS
DECLARE @EmpBenefitDeductID as bigint
SELECT @EmpBenefitDeductID=ISNULL(MAX(EmployeeBenefitsDeducts.EmpBenefitDeductID),0)FROM EmployeeBenefitsDeducts
SET @EmpBenefitDeductID=@EmpBenefitDeductID+1
INSERT INTO EmployeeBenefitsDeducts VALUES
(
EmpBenefitDeductID,
BranchID,
EmployeeID,
BenefitDeductionID,
AffectOnLeave,
Amount,
CreatedUserID,
CreatedDate,
ModifiedUserID,
ModifiedDate
)
VALUES
(
@EmpBenefitDeductID
@BranchID ,
@EmployeeID ,
@BenefitDeductionID ,
@AffectOnLeave ,
@Amount (18,4),
@CreatedUserID ,
@CreatedDate ,
@ModifiedUserID ,
@ModifiedDate
)
SELECT @EmpBenefitDeductID