How do I do this update?

  • I want to lop off the 4th decimal from a column and update that column.

    Example:

    col_a

    1.2345

    2.3456

    3.4567

    I want

    col_a

    1.2340

    2.3450

    3.4560

    I thought it was update table set col_a = Trnucate(col_a,3) but this is wrong.

  • create table ttt(col_a decimal(9,4))

    insert into ttt( col_a )  values (1.2345)

    insert into ttt( col_a )  values (2.3456)

    insert into ttt( col_a )  values (3.4567)

    --- Check before and after

    select  col_a Before , ROUND(col_a, 3, 1) After from ttt

     

    -- Update Data

    update col_a set ttt = ROUND(col_a, 3, 1)

    HTH


    * Noel

Viewing 2 posts - 1 through 1 (of 1 total)

You must be logged in to reply to this topic. Login to reply