src/main/java/com/microsoft/sqlserver/jdbc/SQLServerPreparedStatement.java [1989:2060]:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
                    return updateCounts;
                }

                // From the JDBC spec, section 9.1.4 - Making Batch Updates:
                // The CallableStatement.executeBatch method (inherited from PreparedStatement) will
                // throw a BatchUpdateException if the stored procedure returns anything other than an
                // update count or takes OUT or INOUT parameters.
                //
                // Non-update count results (e.g. ResultSets) are treated as individual batch errors
                // when they are encountered in the response.
                //
                // OUT and INOUT parameter checking is done here, before executing the batch. If any
                // OUT or INOUT are present, the entire batch fails.
                for (Parameter[] paramValues : batchParamValues) {
                    for (Parameter paramValue : paramValues) {
                        if (paramValue.isOutput()) {
                            throw new BatchUpdateException(
                                    SQLServerException.getErrString("R_outParamsNotPermittedinBatch"), null, 0, null);
                        }
                    }
                }

                String tableName = parseUserSQLForTableNameDW(false, false, false, false);
                ArrayList<String> columnList = parseUserSQLForColumnListDW();
                ArrayList<String> valueList = parseUserSQLForValueListDW(false);

                checkAdditionalQuery();

                try (SQLServerStatement stmt = (SQLServerStatement) connection.createStatement(
                        ResultSet.TYPE_FORWARD_ONLY, ResultSet.CONCUR_READ_ONLY, connection.getHoldability(),
                        stmtColumnEncriptionSetting);
                        SQLServerResultSet rs = stmt
                                .executeQueryInternal("sp_executesql N'SET FMTONLY ON SELECT * FROM "
                                        + Util.escapeSingleQuotes(tableName) + " '")) {
                    if (null != columnList && columnList.size() > 0) {
                        if (columnList.size() != valueList.size()) {
                            throw new IllegalArgumentException(
                                    "Number of provided columns does not match the table definition.");
                        }
                    } else {
                        if (rs.getColumnCount() != valueList.size()) {
                            throw new IllegalArgumentException(
                                    "Number of provided columns does not match the table definition.");
                        }
                    }

                    SQLServerBulkBatchInsertRecord batchRecord = new SQLServerBulkBatchInsertRecord(batchParamValues,
                            columnList, valueList, null);

                    for (int i = 1; i <= rs.getColumnCount(); i++) {
                        Column c = rs.getColumn(i);
                        CryptoMetadata cryptoMetadata = c.getCryptoMetadata();
                        int jdbctype;
                        TypeInfo ti = c.getTypeInfo();
                        checkValidColumns(ti);
                        if (null != cryptoMetadata) {
                            jdbctype = cryptoMetadata.getBaseTypeInfo().getSSType().getJDBCType().getIntValue();
                        } else {
                            jdbctype = ti.getSSType().getJDBCType().getIntValue();
                        }
                        batchRecord.addColumnMetadata(i, c.getColumnName(), jdbctype, ti.getPrecision(), ti.getScale());
                    }

                    SQLServerBulkCopy bcOperation = new SQLServerBulkCopy(connection);
                    SQLServerBulkCopyOptions option = new SQLServerBulkCopyOptions();
                    option.setBulkCopyTimeout(queryTimeout);
                    bcOperation.setBulkCopyOptions(option);
                    bcOperation.setDestinationTableName(tableName);
                    bcOperation.setStmtColumnEncriptionSetting(this.getStmtColumnEncriptionSetting());
                    bcOperation.setDestinationTableMetadata(rs);
                    bcOperation.writeToServer(batchRecord);
                    bcOperation.close();
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -



src/main/java/com/microsoft/sqlserver/jdbc/SQLServerPreparedStatement.java [2146:2217]:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
                    return updateCounts;
                }

                // From the JDBC spec, section 9.1.4 - Making Batch Updates:
                // The CallableStatement.executeBatch method (inherited from PreparedStatement) will
                // throw a BatchUpdateException if the stored procedure returns anything other than an
                // update count or takes OUT or INOUT parameters.
                //
                // Non-update count results (e.g. ResultSets) are treated as individual batch errors
                // when they are encountered in the response.
                //
                // OUT and INOUT parameter checking is done here, before executing the batch. If any
                // OUT or INOUT are present, the entire batch fails.
                for (Parameter[] paramValues : batchParamValues) {
                    for (Parameter paramValue : paramValues) {
                        if (paramValue.isOutput()) {
                            throw new BatchUpdateException(
                                    SQLServerException.getErrString("R_outParamsNotPermittedinBatch"), null, 0, null);
                        }
                    }
                }

                String tableName = parseUserSQLForTableNameDW(false, false, false, false);
                ArrayList<String> columnList = parseUserSQLForColumnListDW();
                ArrayList<String> valueList = parseUserSQLForValueListDW(false);

                checkAdditionalQuery();

                try (SQLServerStatement stmt = (SQLServerStatement) connection.createStatement(
                        ResultSet.TYPE_FORWARD_ONLY, ResultSet.CONCUR_READ_ONLY, connection.getHoldability(),
                        stmtColumnEncriptionSetting);
                        SQLServerResultSet rs = stmt
                                .executeQueryInternal("sp_executesql N'SET FMTONLY ON SELECT * FROM "
                                        + Util.escapeSingleQuotes(tableName) + " '")) {
                    if (null != columnList && columnList.size() > 0) {
                        if (columnList.size() != valueList.size()) {
                            throw new IllegalArgumentException(
                                    "Number of provided columns does not match the table definition.");
                        }
                    } else {
                        if (rs.getColumnCount() != valueList.size()) {
                            throw new IllegalArgumentException(
                                    "Number of provided columns does not match the table definition.");
                        }
                    }

                    SQLServerBulkBatchInsertRecord batchRecord = new SQLServerBulkBatchInsertRecord(batchParamValues,
                            columnList, valueList, null);

                    for (int i = 1; i <= rs.getColumnCount(); i++) {
                        Column c = rs.getColumn(i);
                        CryptoMetadata cryptoMetadata = c.getCryptoMetadata();
                        int jdbctype;
                        TypeInfo ti = c.getTypeInfo();
                        checkValidColumns(ti);
                        if (null != cryptoMetadata) {
                            jdbctype = cryptoMetadata.getBaseTypeInfo().getSSType().getJDBCType().getIntValue();
                        } else {
                            jdbctype = ti.getSSType().getJDBCType().getIntValue();
                        }
                        batchRecord.addColumnMetadata(i, c.getColumnName(), jdbctype, ti.getPrecision(), ti.getScale());
                    }

                    SQLServerBulkCopy bcOperation = new SQLServerBulkCopy(connection);
                    SQLServerBulkCopyOptions option = new SQLServerBulkCopyOptions();
                    option.setBulkCopyTimeout(queryTimeout);
                    bcOperation.setBulkCopyOptions(option);
                    bcOperation.setDestinationTableName(tableName);
                    bcOperation.setStmtColumnEncriptionSetting(this.getStmtColumnEncriptionSetting());
                    bcOperation.setDestinationTableMetadata(rs);
                    bcOperation.writeToServer(batchRecord);
                    bcOperation.close();
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -



