SQL Round function - variable
Posted on 2011-03-09
I have a product table that has 3 fields;
Price (to 4 decimals)
DecimalIndicator (this is the number of decimal places that the price will be rounded to)
The decimal indicator will be a number between 0 and 4.
Price = 12.2412
If the decimal indicator is "2" then the price will display as 12.24
If the decimal indicator is "4" then the price will display as 12.2412
I will be using round(Price,X) to determine the price where X is the decimalindicator.
How can I amend my sql Round function to handle this variable decimal place?
Thank you and good night from Ireland!