The issue you are having with floating-point numbers is a common one that can be traced back to the way floating-point arithmetic works in some computers. I see you already made an attempt to cast the sum to a specific decimal format in your SQL query, and I think that the issue may not be in the query itself but how the ADF is reading and writing the data.
Try to inspect the data types in your source SQL database to make sure the data is being handled correctly. If you're dealing with monetary values, consider using the DECIMAL
or MONEY
data type to ensure precision.
In the copy activity, make sure that you're mapping the source and sink correctly. Check the data types in the mapping and make sure they align with your desired format.
You can use a Data Flow with a Derived Column transformation to explicitly set the desired format of the column. Check this if you want to limit the number of decimal places.
round(numericColumn, 2)
As a last resort, you can create a post-copy script that runs after the copy activity, which reads the CSV file, corrects the formatting of the problematic column, and then writes it back to Azure Data Lake. This can be a temporary workaround while you diagnose the underlying issue.