The issue was that I got NaN instead of a number. More exactly, at some point in my code there was a division by 0. Hence, the issue was not with converting Java Double to some SQL type, nor with Liquibase. I have wrongly assumed that the problem might lie there somewhere.
Java double to SQL Server data type
-
05-07-2023 - |
Domanda
I want to insert some Java Double values some columns from a table(I am using SQL Server). How can I create the aforementioned table using Liquibase? More exact, what type should the column be? The attempt below is not working. Apparently Float is not precise enough for that.
<column name="visitsAvg" type="FLOAT"/>
Soluzione 2
Altri suggerimenti
Liquibase uses the JDBC types for columns. The JDBC/SQL type FLOAT
is not the same as the SQL Server type FLOAT
. The JDBC type FLOAT
is a 32 bit single precision floating point. You should specify DOUBLE
if you want 64 bit double precision (FLOAT(53)
in SQL Server).
Likely liquibase translates the request for type="FLOAT"
to a column of type FLOAT(24)
in SQL Server, which is insufficient to store a Java double
with full precision.