Is there any way to cast a number into a decimal with a specified number of decimal places? I tried:
SELECT ...
CAST(NumericField AS NUMERIC(15, @DecimalPlaces) AS NumericField,
...
But it didn’t work.
EDIT: I made a mistake and wrote NUMBER instead of NUMERIC. But the question stands still: How do I cast to a NUMERIC with a specified number of decimal places?
For trailing zeros use this:
Please note, the above select will return a varchar type, not decimal, numeric, float or any other types.