Found this in a code sample

  • Could someone tell what this does/how it works. It was in the select statement

    convert(numeric(10,2), convert(numeric(10,2), IsNull(Run, 0))

    I can figure out part of it but the convert(numeric(10,2), listed 2 times is confusing

    Kurt Kracaw

  • I'll bite.

    I think that one of the convets is redundant. Also I think it's missing a closing bracket right at the end.

    convert(numeric(10,2), convert(numeric(10,2), IsNull(Run, 0))

    could be re-written as

    convert(numeric(10,2), IsNull(Run, 0))

    The IsNull is just substituting 0 if the value of Run is NULL. The convert is forcing the 0 back to 0.00

     

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

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