Update table with data from another table decreasing character

Asked

Viewed 199 times

1

Hello, I have the bank BDMCOM1 that has a table Product Balance and a column Quantity with values like: 1,000. But I have another bank BDMCOM1_V3_ALEA that also has the table Product Balance and column Quantity, only with values in this standard 1,00.

In case I wanted to know how to update the values of the BDMCOM1_V3_ALE bank quantity with the values of the BDMCOM1 bank only removing a character to stay in the correct pattern.

  • 1

    What are the column types of the two tables?

  • All two are decimal, but one is three squares after the comma and the other 2. However I cannot change the property of the table fields.

  • If you just change the bank mechanism itself normally no longer set for you? It does not automatically remove?

  • I want to take the updated data from the other table and put it in the new database without changing its structure, just removing the last character to be in the correct pattern.

  • 1

    If changing normally and the bank itself not treating this, Oce can try on update or Insert round the value to two houses as and in its 'ROUND(VALUE, 2)' so it will format to two houses.

1 answer

1


I took a test here:

declare @teste decimal(10, 3);
select @teste = 3.456;

select convert(decimal(10, 2), @teste);
-- Resultado: 3.46

If the source and destination fields are decimal and different details, the simple value envelope works, but with the loss of the last decimal place, with the rounding up, if the last box is between 5 and 9, and down if the last box is between 0 and 4.

Browser other questions tagged

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