none
Round function on (real) RRS feed

  • Question

  • Hello,

    is it possible to use Round function as a trigger after an update or insert on (real) data?

    if yes so maybe an example will help.

    need to be 3 decimal only

    working on sql 2008 server

    thank you.


    • Edited by AbanoubZak Friday, September 27, 2019 5:58 AM
    Friday, September 27, 2019 5:57 AM

Answers

  • You can not really control the count of decimals of an unprecise data type like real/float

    DECLARE @test real = 1234567.7654432;
    
    SELECT ROUND(@test, 3);

    Result: 1234567.75

    Use a precise data type like decimal/numeric instaed


    Olaf Helper

    [ Blog] [ Xing] [ MVP]

    • Marked as answer by AbanoubZak Friday, September 27, 2019 6:48 AM
    Friday, September 27, 2019 6:39 AM
    Moderator