我在这一行收到错误
try {
if (toolsDialect.getDataStoreType().equals(DataStoreType.SQLSERVER)) {
String sqlString = "IF OBJECT_ID('" + t.getName() + "') IS NOT NULL ";
executeSql(jdbc, t.sqlDropString(dialect, null, schema), sqlString);
} else {
executeSql(jdbc, t.sqlDropString(dialect, null, schema));
}
} catch (BadSqlGrammarException e) {
//don't care if table doesn't exist
}
}
if (newTable || modifiedColumns.size() > 0) {
//create new table with correct structure
Table t = new Table(createTableName);
sqlStr.append(dialect.getCreateTableString())
.append(" ")
.append(t.getQualifiedName(dialect, null, schema)).append("(");
newColumns.addAll(modifiedColumns);
for (Iterator it = newColumns.iterator(); it.hasNext(); ) {
ColumnMigrationSpec spec = (ColumnMigrationSpec) it.next();
sqlStr.append(spec.columnName);
sqlStr.append(" ").append(spec.columnSpec);
if (it.hasNext()) sqlStr.append(", ");
}
sqlStr.append(")");
if (tableMeta != null) sqlStr.append(" ").append(tableMeta);
executeSql(jdbc, sqlStr.toString());
if (newTable) return 0;
}
if (modifiedColumns.size() == 0) {
Table t = new Table(tableName);
for (Iterator it = newColumns.iterator(); it.hasNext(); ) {
ColumnMigrationSpec spec = (ColumnMigrationSpec) it.next();
StringBuilder buf = new StringBuilder()
.append("alter table ")
.append(t.getQualifiedName(dialect, null, schema)).append(" ")
.append(dialect.getAddColumnString()).append(" ")
.append(spec.columnName).append(" ")
.append(spec.columnSpec);
executeSql(jdbc, buf.toString());
}
for (Iterator it = deletedColumns.iterator(); it.hasNext(); ) {
String colName = (String) it.next();
Column col = new Column(colName);
String sql = "alter table " + t.getQualifiedName(dialect, null, schema) + " drop column " + col.getQuotedName(dialect);
executeSql(jdbc, sql);
}
return 0;
}
newColumns.removeAll(modifiedColumns);
modifiedColumns.addAll(newColumns);
//
//insert data into new table by selecting from old table
sqlStr = new StringBuilder(2000);
Table ct = new Table(createTableName);
sqlStr.append("insert into ").append(ct.getQualifiedName(dialect, null, schema));
sqlStr.append("(");
引起:com.microsoft.sqlserver.jdbc.SQLServerException:不正确 语法附近')'。在 com.microsoft.sqlserver.jdbc.SQLServerException.makeFromDatabaseError(SQLServerException.java:197) 在 com.microsoft.sqlserver.jdbc.SQLServerStatement.getNextResult(SQLServerStatement.java:1493)
任何人都可以解释原因。