copy and delete Table

This commit is contained in:
SwallowGG
2024-06-27 11:50:55 +08:00
parent 0152ec4ead
commit 57f0cfa2db
10 changed files with 125 additions and 14 deletions

View File

@ -203,4 +203,15 @@ public class SqlServerDBManage extends DefaultDBManage implements DBManage {
throw new RuntimeException(e);
}
}
@Override
public void copyTable(Connection connection, String databaseName, String schemaName, String tableName, String newTableName,boolean copyData) throws SQLException {
String sql = "";
if(copyData){
sql = "SELECT * INTO " + newTableName + " FROM " + tableName;
}else {
sql = "SELECT * INTO " + newTableName + " FROM " + tableName + " WHERE 1=0";
}
SQLExecutor.getInstance().execute(connection, sql, resultSet -> null);
}
}