substitute to Eval function

  • I need a substitute for de access function eval in sql or reporting server.

    I have a string like '10.10+20.20--10'. The resulte is 40.3

    thanks in advance

  • I think you can just set the source to:

    =10.10+20.20--10

    If not, you may need to use the convert function to convert each "string" "number" to a decimal.|

    i.e. convert(decimal(5,2), 10.10)+convert(decimal(5,2),20.20)...

    I could be way off base or misinterpreting the question.

    -Megan

  • A easier way using only EXEC :

    EXEC('SELECT CAST(

    (1.66 * 300 / 1170)

    + (1.75 * 220 / 1170)

    + (1.791 * 0 / 1170)

    + (1.6666 * 100 / 1170)

    + (1.96 * 350 / 1170)

    + (1.8716 * 100 / 1170)

    + (1.6666 * 0 / 1170)

    + (1.44 * 100 / 1170)

    AS DECIMAL(18,4))')

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

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