Skip to content

Commit

Permalink
HHH-18043 Change SQL Server default timestamp precision to 7
Browse files Browse the repository at this point in the history
  • Loading branch information
beikov committed May 2, 2024
1 parent 7e3b72a commit 0c915dc
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 21 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -806,18 +806,9 @@ public SQLExceptionConversionDelegate buildSQLExceptionConversionDelegate() {
};
}

/**
* SQL server supports up to 7 decimal digits of
* fractional second precision in a datetime2,
* but since its duration arithmetic functions
* try to fit durations into an int,
* which is impossible with such high precision,
* so default to generating {@code datetime2(3)}
* columns.
*/
@Override
public int getDefaultTimestampPrecision() {
return 6; //microseconds!
return 7;
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -774,18 +774,9 @@ public SQLExceptionConversionDelegate buildSQLExceptionConversionDelegate() {
};
}

/**
* SQL server supports up to 7 decimal digits of
* fractional second precision in a datetime2,
* but since its duration arithmetic functions
* try to fit durations into an int,
* which is impossible with such high precision,
* so default to generating {@code datetime2(3)}
* columns.
*/
@Override
public int getDefaultTimestampPrecision() {
return 6; //microseconds!
return 7;
}

/**
Expand Down
3 changes: 2 additions & 1 deletion migration-guide.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -132,9 +132,10 @@ String isDefault();


[[ddl-implicit-datatype-timestamp]]
== Default precision for Oracle timestamp
== Default precision for timestamp on some databases

The default precision for Oracle timestamps was changed to 9 i.e. nanosecond precision.
The default precision for SQL Server timestamps was changed to 7 i.e. 100 nanosecond precision.

[[todo]]
== Todos (dev)
Expand Down

0 comments on commit 0c915dc

Please sign in to comment.