SQL script to adjust decimal point of a column - Postgresql

Asked

Viewed 186 times

0

I have a table in Postgresql that has the field IdProduto and Quantidade. The values in the column Quantidade were recorded to the wrong decimal places.

Ex: It was recorded 9000,000 when it should be 9,000. The lack of a comma caused the value to rise from 9 units to 9 thousand.

There is a way for me to get this right via sql script for all products?

  • What kind of column is that? If you give a more complete example of the table structure and more examples of the data it’s easier for the community to help.

  • 1

    If it’s a numeric field, do an update of everything dividing by a thousand, like update [tabela] set [campo] = [campo]/1000;. For a more detailed answer, improve the question: add your table schema and one or two example records...

  • @Camilosantos, the guy is Numeric...

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.