@Override
   public ResultSet readTable (String tableName, String[] columns, int nThread) throws SQLException {

      // If table name parameter is null get it from options
      tableName = tableName == null ? this.options.getSourceTable() : tableName;

      // If columns parameter is null, get it from options
      String allColumns = this.options.getSourceColumns() == null ? "*" : this.options.getSourceColumns();

      String sqlCmd;

      // Read table with source-query option specified
      if (options.getSourceQuery() != null && !options.getSourceQuery().isEmpty()) {

         if (options.getJobs() == 1)
            sqlCmd = "SELECT * FROM (" +
                options.getSourceQuery() + ") as REPDBQUERY where 0 = ?";
         else
            throw new UnsupportedOperationException("ReplicaDB on SQLServer still not support custom query parallel process. Use properties instead: source.table, source.columns and source.where ");
      }
      // Read table with source-where option specified
      else if (options.getSourceWhere() != null && !options.getSourceWhere().isEmpty()) {

         sqlCmd = "SELECT  " +
             allColumns +
             " FROM " +
             escapeTableName(tableName);

         if (options.getJobs() == 1)
            sqlCmd = sqlCmd + " where " + options.getSourceWhere() + " AND 0 = ?";
         else
            sqlCmd = sqlCmd + " where " + options.getSourceWhere() + " ABS(CHECKSUM(%% physloc %%)) % " + (options.getJobs()) + " = ?";

      } else {
         // Full table read. Force NO_IDEX and table scan
         sqlCmd = "SELECT  " +
             allColumns +
             " FROM " +
             escapeTableName(tableName);

         if (options.getJobs() == 1)
            sqlCmd = sqlCmd + " where 0 = ?";
         else
            sqlCmd = sqlCmd + " where ABS(CHECKSUM(%% physloc %%)) % " + (options.getJobs()) + " = ?";

      }

      return super.execute(sqlCmd, (Object) nThread);

   }
Log the error message and the column name and length that caused the error using reflection.

@param bulkCopy the SQLServerBulkCopy object
@param ex       the SQLException
src/main/java/org/replicadb/manager/SQLServerManager.java