@Override
  public void moveColumnToAnotherTable(String sourceTableName, DBColumnInfo sourceColumn, String sourceIDFieldName,
              String targetTableName, DBColumnInfo targetColumn, String targetIDFieldName, Object initialValue) throws SQLException {

    if (tableHasColumn(sourceTableName, sourceIDFieldName) &&
      tableHasColumn(sourceTableName, sourceColumn.getName()) &&
      tableHasColumn(targetTableName, targetIDFieldName)
    ) {

      final String moveSQL = dbmsHelper.getCopyColumnToAnotherTableStatement(sourceTableName, sourceColumn.getName(),
        sourceIDFieldName, targetTableName, targetColumn.getName(),targetIDFieldName);
      final boolean isTargetColumnNullable = targetColumn.isNullable();

      targetColumn.setNullable(true);  // setting column nullable by default to move rows with null

      addColumn(targetTableName, targetColumn);
      executeUpdate(moveSQL, false);

      if (initialValue != null) {
        String updateSQL = dbmsHelper.getColumnUpdateStatementWhereColumnIsNull(convertObjectName(targetTableName),
          convertObjectName(targetColumn.getName()), convertObjectName(targetColumn.getName()));

        executePreparedUpdate(updateSQL, initialValue);
      }

      if (!isTargetColumnNullable) {
        setColumnNullable(targetTableName, targetColumn.getName(), false);
      }
      dropColumn(sourceTableName, sourceColumn.getName());
    }
  }
Move column data from {@code sourceTableName} to {@code targetTableName} using {@code sourceIDFieldName} and
{@code targetIDFieldName} keys to match right rows

@param sourceTableName
         the source table name
@param sourceColumn
         the source column name
@param sourceIDFieldName
         the source id key filed name matched with {@code targetIDFieldName}
@param targetTableName
         the target table name
@param targetColumn
         the target column name
@param targetIDFieldName
         the target id key name matched with {@code sourceIDFieldName}
@param initialValue
         initial value for null-contained cells
@throws SQLException
ambari-server/src/main/java/org/apache/ambari/server/orm/DBAccessorImpl.java