SQL Remove Trailing Decimal Places
Within a recent project, I’ve been extracting data from Microsoft Dynamics NAV using Taskcentre.
Within NAV, decimals are stored as decimal(38,20), complete will all 20 decimal places..!
The following SQL query is very handy at removing the un-required decimal places (but keeping the accuracy of the data)
SELECT CONVERT(DOUBLE PRECISION, 1.99990000000000000000) ,CONVERT(DOUBLE PRECISION, 2.00000000000000000000) ,CONVERT(DOUBLE PRECISION, 3.00005077000000000000)
The results of the above query is:
1.9999 2 3.00005077