I have a calculated field in a SQL query that sometimes ends up in running decimal fields for more than 15 decimal places. I want to evenly truncate it to 6 decimal places for all records. Please let me know the command in SQL to do so.
Thanks
Printable View
I have a calculated field in a SQL query that sometimes ends up in running decimal fields for more than 15 decimal places. I want to evenly truncate it to 6 decimal places for all records. Please let me know the command in SQL to do so.
Thanks
If it is SQL Server you can use CAST or CONVERT functions
select CONVERT(decimal(25,6),yourvariable)
from yourtable
or
select CAST(yourvariable as decimal(25,6))
from yourtable