The c# program used double variables and registered them in the column of type numeric(12,3) of SQL server, and it turned out to be 0.
The actual formula is 99999999.999-9999999.998
The answer is 0.001.
When I registered this answer with Oracle number (12,3), it was 0.001, but when I registered with SQL server, it was zero.
Is the parameter mapping method incorrect when registering?
c# sql-server
SQL Server numeric type is numeric(18,0)
if no precision is specified.Since scale=0, we can only handle integers.This is probably the reason.
Although the questionnaire does not mention how C# passed the data to SQL Server, it is presumed that accuracy was not specified when passing it.For example, C#'s decimal
(.NET's System.decimal
) was automatically converted without any accuracy hints.
The reason seems to be that the calculation result for double type was less than 0.001.
Oracle will register the results at 0.001, but SQL server will register truncated to 0.000.
During the operation, I was able to solve this problem by calculating once in the decimal type and registering the results.
© 2024 OneMinuteCode. All rights reserved.