diff --git a/plugins/dbgate-plugin-mssql/src/backend/MsSqlAnalyser.js b/plugins/dbgate-plugin-mssql/src/backend/MsSqlAnalyser.js index 464d1cbf..dfea07e9 100644 --- a/plugins/dbgate-plugin-mssql/src/backend/MsSqlAnalyser.js +++ b/plugins/dbgate-plugin-mssql/src/backend/MsSqlAnalyser.js @@ -36,9 +36,12 @@ function getColumnInfo({ defaultConstraint, }) { let fullDataType = dataType; - if (charMaxLength && isTypeString(dataType)) fullDataType = `${dataType}(${charMaxLength})`; - if (numericPrecision && numericScale && isTypeNumeric(dataType)) + if (charMaxLength && isTypeString(dataType)) { + fullDataType = `${dataType}(${charMaxLength < 0 ? 'MAX' : charMaxLength})`; + } + if (numericPrecision && numericScale && isTypeNumeric(dataType)) { fullDataType = `${dataType}(${numericPrecision},${numericScale})`; + } return { columnName, dataType: fullDataType,