【问题标题】:SQL Server 2005 and Datanucleus problem (ntext query)SQL Server 2005 和 Datanucleus 问题(ntext 查询)
【发布时间】:2010-10-10 10:29:57
【问题描述】:

SQL Server 2005 开始出现错误

这是我第一次使用 Datanucleus 2.x 测试我们的应用程序(最后一次测试是使用 DN 1.x 进行的)

我使用 Eclipse RCP。

Caused by: com.microsoft.sqlserver.jdbc.SQLServerException: The ntext data type cannot be selected as DISTINCT because it is not comparable.
at com.microsoft.sqlserver.jdbc.SQLServerException.makeFromDatabaseError(SQLServerException.java:197)
at com.microsoft.sqlserver.jdbc.SQLServerStatement.getNextResult(SQLServerStatement.java:1493)
at com.microsoft.sqlserver.jdbc.SQLServerPreparedStatement.doExecutePreparedStatement(SQLServerPrepared
Statement.java:390)
at com.microsoft.sqlserver.jdbc.SQLServerPreparedStatement$PrepStmtExecCmd.doExecute(SQLServerPreparedStatement.java:340)
at com.microsoft.sqlserver.jdbc.TDSCommand.execute(IOBuffer.java:4575)
at com.microsoft.sqlserver.jdbc.SQLServerConnection.executeCommand(SQLServerConnection.java:1400)
at com.microsoft.sqlserver.jdbc.SQLServerStatement.executeCommand(SQLServerStatement.java:179)
at com.microsoft.sqlserver.jdbc.SQLServerStatement.executeStatement(SQLServerStatement.java:154)
at com.microsoft.sqlserver.jdbc.SQLServerPreparedStatement.executeQuery(SQLServerPreparedStatement.java
:283)
at org.datanucleus.store.rdbms.SQLController.executeStatementQuery(SQLController.java:463)
at org.datanucleus.store.rdbms.query.JDOQLQuery.performExecuteInternal(JDOQLQuery.java:755)
... 5 more

【问题讨论】:

    标签: sql-server eclipse sql-server-2005 datanucleus


    【解决方案1】:

    正如第一行提到的,您正在尝试对其中包含 ntext 类型字段的结果集执行 DISTINCT .. 这是不可能的..

    查看Is there any way to DISTINCT or group by a text (or ntext) in SQL Server 2005? 以获得可能的解决方案。 (将字段转换为 nvarchar(max))

    【讨论】:

      猜你喜欢
      • 2011-06-29
      • 1970-01-01
      • 2011-03-10
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2011-01-25
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多