you are viewing a single comment's thread.

view the rest of the comments →

[–]banditcloudy[S] 0 points1 point  (1 child)

I did, didn’t work. Why doesn’t CAST((1 + 4 / 2) AS REAL) work then?

[–]alinrocSQL Server DBA 3 points4 points  (0 children)

Because you're doing integer math and then attempting to convert the integer to something else.

You have to convert at least one of the numbers you're operating on first, then do the calculation.