当前使用版本(必填,否则不予处理)

3.3.2

该问题是如何引起的?(确定最新版也有问题再提!!!)

在 SqlServer 数据库中字符模糊查询使用 LIKE 时,CONCAT() 函数报错,因为在 SqlServer 中不存在 CONCAT 函数。

重现步骤(如果有就写完整)

类属性使用注解 @TableField(condition = SqlCondition.LIKE)

报错信息

Error querying database. Cause: com.microsoft.sqlserver.jdbc.SQLServerException: 'CONCAT' 不是可以识别的 内置函数名称。

The error may exist in xxxMapper.java (best guess)

The error may involve defaultParameterMap

The error occurred while setting parameters

SQL: SELECT * FROM xxx WHERE xxx LIKE CONCAT('%',?,'%')

Cause: com.microsoft.sqlserver.jdbc.SQLServerException: 'CONCAT' 不是可以识别的 内置函数名称。

; uncategorized SQLException; SQL state [S00010]; error code [195]; 'CONCAT' 不是可以识别的 内置函数名称。; nested exception is com.microsoft.sqlserver.jdbc.SQLServerException: 'CONCAT' 不是可以识别的 内置函数名称。

Comment From: miemieYaho

那你就自己定义一个用