SQL Update to flip the sign of a value?

Someone entered a ton of numerical data into a table with a backslash.

Is there a clean way to flip a character in a numeric column using an SQL statement?

+5
source share
4 answers
update my_table
  set amount = -amount
  where <whatever>
+10
source

UPDATE [table] SET [column]=([column]*(-1))

You can add the sentence WHEREneeded to limit which lines you flip characters to.

+4
source

.

update table set column = -column;
+2
UPDATE MyTable
SET amount = -amount
WHERE amount = ABS(amount)

= ABS (), . , .

0

All Articles