Patrick O'Dea
asked on
SQL Round function - variable
I have a product table that has 3 fields;
ProductCode
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.
Example:
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!
ProductCode
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.
Example:
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!
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER