Reputation: 67
If I use the parameters to set the value in order to update the fields, nothing has been updated, but if I assign the value to the field directly, everything works fine. Here is my sql script with parameters that won't work:
DECLARE @ItemValue NUMERIC(2,1) = 0.0,
@ItemName NVARCHAR = NULL,
@RuleID INT,
@IsValid BIT
SET @ItemValue =9
SET @ItemName = 'chbWorkingTimePerDay'
SET @RuleID = 1
SET @IsValid = 1
UPDATE hrms.RuleValue
SET ItemValue = @ItemValue,
IsValid = @IsValid
FROM hrms.RuleItem RI
JOIN hrms.RuleValue RV
ON RI.RuleItemID = RV.RuleItemID
WHERE RI.ItemName = @ItemName
AND RV.RuleID = @RuleID
Here is my sql script without parameters that works:
UPDATE hrms.RuleValue
SET ItemValue = 8.0,
IsValid = 1
FROM hrms.RuleItem RI
JOIN hrms.RuleValue RV
ON RI.RuleItemID = RV.RuleItemID
WHERE RI.ItemName = 'chbWorkingTimePerDay'
AND RV.RuleID = 1
Upvotes: 2
Views: 82