mybatis执行sqlserver的sql报错
com.microsoft.sqlserver.jdbc.SQLServerException: 不支持“variant”数据类型。 at com.microsoft.sqlserver.jdbc.SQLServerException.makeFromDriverError(SQLServerException.java:190) ~[sqljdbc4-4.0.jar:na] at com.microsoft.sqlserver.jdbc.TypeInfo$Builder$16.apply(dtv.java:1996) ~[sqljdbc4-4.0.jar:na] at com.microsoft.sqlserver.jdbc.TypeInfo$Builder.build(dtv.java:2158) ~[sqljdbc4-4.0.jar:na] at com.microsoft.sqlserver.jdbc.TypeInfo.getInstance(dtv.java:2221) ~[sqljdbc4-4.0.jar:na] at com.microsoft.sqlserver.jdbc.StreamColumns.setFromTDS(StreamColumns.java:46) ~[sqljdbc4-4.0.jar:na] at com.microsoft.sqlserver.jdbc.SQLServerResultSet$1CursorInitializer.onColMetaData(SQLServerResultSet.java:217) ~[sqljdbc4-4.0.jar:na] at com.microsoft.sqlserver.jdbc.TDSParser.parse(tdsparser.java:77) ~[sqljdbc4-4.0.jar:na] at com.microsoft.sqlserver.jdbc.SQLServerResultSet.<init>(SQLServerResultSet.java:311) ~[sqljdbc4-4.0.jar:na] at com.microsoft.sqlserver.jdbc.SQLServerStatement.getNextResult(SQLServerStatement.java:1526) ~[sqljdbc4-4.0.jar:na] at com.microsoft.sqlserver.jdbc.SQLServerPreparedStatement.doExecutePreparedStatement(SQLServerPreparedStatement.java:404) ~[sqljdbc4-4.0.jar:na] at com.microsoft.sqlserver.jdbc.SQLServerPreparedStatement$PrepStmtExecCmd.doExecute(SQLServerPreparedStatement.java:350) ~[sqljdbc4-4.0.jar:na] at com.microsoft.sqlserver.jdbc.TDSCommand.execute(IOBuffer.java:5696) ~[sqljdbc4-4.0.jar:na]
原因是:SqlServer的jdbc的缺陷, 需要强制转换
修改前:
ISNULL(ep.[value], ‘‘) as columnDescribe
修改后:
CONVERT(varchar(50),ISNULL(ep.[value], ‘‘)) as columnDescribe
原文地址:https://www.cnblogs.com/skyessay/p/9054652.html
时间: 2024-10-14 06:48:29