get precision part in casting

  • hi all,

    how can i get the precision part from this

    select cast(73982597/1000 as numeric(8,3))

    thanks in advc

    [font="Comic Sans MS"]
    ---------------------------------------------------

    Thanks [/font]

  • DECLARE @Num AS Numeric(8)

    SET @Num = 73982597

    select cast(@Num/1000 as Numeric(8,3))

    This will also return what you seem to require

    select cast(73982597./1000 as numeric(8,3))

    In the code immediately above note the decimal point..

    Returns: 73982.597

    If everything seems to be going well, you have obviously overlooked something.

    Ron

    Please help us, help you -before posting a question please read[/url]
    Before posting a performance problem please read[/url]

  • SQL Learner-684602 (11/10/2009)


    hi all,

    how can i get the precision part from this

    select cast(73982597/1000 as numeric(8,3))

    thanks in advc

    This is basically the same question you asked here just worded slightly differently.

    Same thing, integer arithmetic. This will give you what you are looking for as well:

    select cast(73982597/1000.0 as numeric(8,3))

  • Thank You Lynn :-):-):-)

    Thank You bitbucket-25253 :-):-):-)

    Thank You :-):-):-)

    Thank You :-):-):-)

    [font="Comic Sans MS"]
    ---------------------------------------------------

    Thanks [/font]

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

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