How float data type will round

  • Hi

    How a float datatype (for example, 3.7854398123234) in 2008 Sql server2008R2 will Round (for example, be converted to 3.785)

    in The following command:

    update dbo.tblgas01g4c40

    set DailyConsumption = Convert (float,Consumption)/convert(float,FindDiffRead) where (FindDiffRead<>0)

    Up to 14 decimal places as the DailyConsumption 23.8335679333543 comes.

    Please help me

    thanks.

  • hoseini_akram (8/3/2012)


    Hi

    How a float datatype (for example, 3.7854398123234) in 2008 Sql server2008R2 will Round (for example, be converted to 3.785)

    in The following command:

    update dbo.tblgas01g4c40

    set DailyConsumption = Convert (float,Consumption)/convert(float,FindDiffRead) where (FindDiffRead<>0)

    Up to 14 decimal places as the DailyConsumption 23.8335679333543 comes.

    Please help me

    thanks.

    I'm not sure what you are asking as your question is a bit vague.

  • hoseini_akram (8/3/2012)


    Hi

    How a float datatype (for example, 3.7854398123234) in 2008 Sql server2008R2 will Round (for example, be converted to 3.785)

    in The following command:

    update dbo.tblgas01g4c40

    set DailyConsumption = Convert (float,Consumption)/convert(float,FindDiffRead) where (FindDiffRead<>0)

    Up to 14 decimal places as the DailyConsumption 23.8335679333543 comes.

    Please help me

    thanks.

    Have to agree with Lynn. Confusing info, or not enough background.

    I don't see where you plan on rounding (I suspect there isn't any rounding actually happening, since you're only doing converts.). By default, using float with no length defaults to float(53) (i.e. the largest float there is).

    ----------------------------------------------------------------------------------
    Your lack of planning does not constitute an emergency on my part...unless you're my manager...or a director and above...or a really loud-spoken end-user..All right - what was my emergency again?

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

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