diff --git a/internal/statements/statement.go b/internal/statements/statement.go index 2a7ae8b0..edc7bb49 100644 --- a/internal/statements/statement.go +++ b/internal/statements/statement.go @@ -827,10 +827,6 @@ func (statement *Statement) buildConds2(table *schemas.Table, bean interface{}, continue } - if statement.dialect.URI().DBType == schemas.MSSQL && (col.SQLType.Name == schemas.Text || - col.SQLType.IsBlob() || col.SQLType.Name == schemas.TimeStampz) { - continue - } if col.IsJSON { continue } @@ -862,6 +858,15 @@ func (statement *Statement) buildConds2(table *schemas.Table, bean interface{}, continue } + if statement.dialect.URI().DBType == schemas.MSSQL && (col.SQLType.Name == schemas.Text || + col.SQLType.IsBlob() || col.SQLType.Name == schemas.TimeStampz) { + if utils.IsValueZero(fieldValue) { + continue + } + + return nil, fmt.Errorf("column %s is a TEXT type which cannot be as compare condition", col.Name) + } + requiredField := useAllCols if b, ok := getFlagForColumn(mustColumnMap, col); ok { if b {