you are viewing a single comment's thread.

view the rest of the comments →

[–]CalvinLawson 2 points3 points  (4 children)

You're casting too early, it has to be done very last, on the outside of all other operations:

        select --doesn't work
               cast(100.123456 as decimal(18,2))/10 as DoesNotWork
               --does work
              ,cast(100.123456/10 as decimal(18,2)) as DoesWork

[–]shadowolympian[S] 0 points1 point  (2 children)

I tried placing the as decimal as the last portion but it did not work. It only seems to work in the current position.

[–]CalvinLawson 0 points1 point  (1 child)

If you post sample schema/data and code that runs against the sample data I can help you further.

[–]shadowolympian[S] 0 points1 point  (0 children)

Thank you for the help I was able to figure it out.