{"record":{"id":"8f99445a7acdbf21","repo":"apache/seatunnel","slug":"the-decimal-column-type-decimal-is-out-o-8f9944","errorCode":null,"errorMessage":"The decimal column {} type decimal({},{}) is out of range, which exceeds the maximum scale of {}, it will be converted to decimal({},{})","messagePattern":"The decimal column (.+?) type decimal\\((.+?),(.+?)\\) is out of range, which exceeds the maximum scale of (.+?), it will be converted to decimal\\((.+?),(.+?)\\)","errorType":"console","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"seatunnel-connectors-v2/connector-jdbc/src/main/java/org/apache/seatunnel/connectors/seatunnel/jdbc/internal/dialect/sqlserver/SqlServerTypeConverter.java","lineNumber":390,"sourceCode":"                            decimalType.getScale(),\n                            MAX_PRECISION,\n                            precision,\n                            scale);\n                }\n                if (scale < 0) {\n                    scale = 0;\n                    log.warn(\n                            \"The decimal column {} type decimal({},{}) is out of range, \"\n                                    + \"which is scale less than 0, \"\n                                    + \"it will be converted to decimal({},{})\",\n                            column.getName(),\n                            decimalType.getPrecision(),\n                            decimalType.getScale(),\n                            precision,\n                            scale);\n                } else if (scale > MAX_SCALE) {\n                    scale = MAX_SCALE;\n                    log.warn(\n                            \"The decimal column {} type decimal({},{}) is out of range, \"\n                                    + \"which exceeds the maximum scale of {}, \"\n                                    + \"it will be converted to decimal({},{})\",\n                            column.getName(),\n                            decimalType.getPrecision(),\n                            decimalType.getScale(),\n                            MAX_SCALE,\n                            precision,\n                            scale);\n                }\n                builder.columnType(String.format(\"%s(%s,%s)\", SQLSERVER_DECIMAL, precision, scale));\n                builder.dataType(SQLSERVER_DECIMAL);\n                builder.precision(precision);\n                builder.scale(scale);\n                break;\n            case STRING:\n                if (column.getColumnLength() == null || column.getColumnLength() <= 0) {\n                    builder.columnType(MAX_NVARCHAR);","sourceCodeStart":372,"sourceCodeEnd":408,"githubUrl":"https://github.com/apache/seatunnel/blob/cf67b549a7a6c35fa0beb12d83c62892427ea919/seatunnel-connectors-v2/connector-jdbc/src/main/java/org/apache/seatunnel/connectors/seatunnel/jdbc/internal/dialect/sqlserver/SqlServerTypeConverter.java#L372-L408","documentation":"A DECIMAL column's scale exceeds SQL Server's maximum allowed scale (MAX_SCALE). reconvert clamps scale to MAX_SCALE (precision permitting) and logs a warning that the effective type is coarser than requested.","triggerScenarios":"reconvert sees DecimalType with scale > MAX_SCALE — e.g. decimal(38,40) or high-precision fractional values from engines that permit scale up to precision bounds larger than SQL Server's.","commonSituations":"Syncing high-precision financial data (e.g. decimal(20,19), or scale exceeding limits) into SQL Server; schemas copied from PostgreSQL NUMERIC with large scales.","solutions":["Reduce the scale in your schema to the SQL Server limit (e.g. decimal(38,10)).","Pre-round/scale values in a transform if sub-limit precision matters.","Accept the warning if losing trailing precision is fine."],"exampleFix":"// before\nfield = { name = \"rate\", type = \"decimal(10,9)\" } // if scale > MAX_SCALE\n// after\nfield = { name = \"rate\", type = \"decimal(10,6)\" } // scale clamped to MAX_SCALE","handlingStrategy":"validation","validationCode":"if (dt.getScale() > MAX_SCALE) log.warn(\"scale {} exceeds SQL Server max {}; reduce in schema\", dt.getScale(), MAX_SCALE);","typeGuard":"boolean fitsSqlServerScale(DecimalType dt) { return dt.getScale() <= 38 && dt.getScale() <= dt.getPrecision(); }","tryCatchPattern":null,"preventionTips":["Keep scale <= precision and within SQL Server limits","Pre-round high-scale financial values in transforms","Document expected precision when migrating from PostgreSQL/Oracle NUMERIC"],"tags":["jdbc","sqlserver","decimal","type-conversion"],"backgroundTag":"value-out-of-range","analyzedSha":"cf67b549a7a6c35fa0beb12d83c62892427ea919","analyzedAt":"2026-09-10T21:44:55.265Z","contentChangedAt":"2026-09-10T21:44:55.265Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}