Take the following update statement.
UPDATE TABLE_1
SET Units2 = ABS(Units1)
,Dollars2=ABS(Dallars1)
,Units1 =0
,Dollars1 =0
WHERE Units1 < 0
AND Dollars2 = 0
Here are my questions,
1) Is this legal? It parses and it “seems” to work (on the test table), but will it always work or am I just picking the right records to review.
2) is there a better way to do this.
Thanks,
It is legal, and as long as you are wanting to essentially keep the old values of
Units1andDollars1inUnits2andDollars2that should workHere’s a test:
Outputs: