Bonediggler1
Technical User
Hello
I am performing a pricing validation based on data in a table and based on this validation will update a comment field in the same table. The sample data might be:
Field1 Field2 Comment
$10 $5 "Field1 should be $8 - Field 2 should be $3"
To do this, I wanted to basically build a string based on the results of the pricing validation, and then update the Comment field with that string. Something like:
DECLARE @STRING VARCHAR(MAX)
UPDATE PRICING_TABLE
SET COMMENT =
CASE WHEN FIELD1 <> '10' THEN SET @STRING = 'Field1 should be $8' END
CASE WHEN FIELD2 <> '5' THEN SET @STRING = @STRING + '-Field2 Should be $3' END
-----------------------------
Unfortunately this method does not seem possible as I get a lot of incorrect syntax errors. Any suggestions?
I am performing a pricing validation based on data in a table and based on this validation will update a comment field in the same table. The sample data might be:
Field1 Field2 Comment
$10 $5 "Field1 should be $8 - Field 2 should be $3"
To do this, I wanted to basically build a string based on the results of the pricing validation, and then update the Comment field with that string. Something like:
DECLARE @STRING VARCHAR(MAX)
UPDATE PRICING_TABLE
SET COMMENT =
CASE WHEN FIELD1 <> '10' THEN SET @STRING = 'Field1 should be $8' END
CASE WHEN FIELD2 <> '5' THEN SET @STRING = @STRING + '-Field2 Should be $3' END
-----------------------------
Unfortunately this method does not seem possible as I get a lot of incorrect syntax errors. Any suggestions?