SSIS - 将多个SQL源中的数据导出到单个excel文件

时间:2016-11-23 20:49:43

标签: excel ssis

function confirm_order($id, $newarray, $cn) {
    $today = date('y-m-d');
    $expiry = date('Y-m-d', strtotime("+30 days"));
    $total_items = 0;
    $total_price = 0;
    foreach ($newarray as $key => $val) {
        $total_items++;
        foreach ($val as $doc) {
            $total_price = $total_price + $doc->doc_price;
        }
    }

    $pin = random_string('alnum', 8);

    $sql = "INSERT INTO orders (order_id, order_UserId, order_total_items, order_amount, date_created,order_status,order_pin)
    VALUES ('', '" . $id . "', '" . $total_items . "', '" . $total_price . "', '" . $today . "','0','" . $pin . "')";

    if (mysqli_query($cn, $sql)) {
        $order_id = mysqli_insert_id($cn);

        foreach ($newarray as $key => $val) {
            $total_docs = 0;
            $total_items++;
            $sep = '|';
            $sub_price = 0;
            $doc_list = '';
            foreach ($val as $doc) {
                $doc_list .= $doc->doc_id . $sep;
                $sub_price = $sub_price + $doc->doc_price;
                $total_docs++;
                $sep = '|';
            }

            $sql = "INSERT INTO cart_items (uc_id, uc_user_id, uc_course_id, uc_course_docs_id, uc_course_docs_num,uc_price,uc_order_num,uc_order_status,uc_dateBuy,uc_dateExpire)
            VALUES ('', '" . $id . "', '" . $key . "', '" . $doc_list . "', '" . $total_docs . "','" . $sub_price . "','" . $order_id . "','0','" . $today . "','" . $expiry . "')";

            mysqli_query($cn, $sql);
        }

        $response_array['status'] = 'success';
        $response_array['message'] = 'Your Order has Processed. Please Note this pin <b style="background-color:green;">' . $pin . '</b> and send it to the admin with payment details.';
    } else {
        $response_array['status'] = 'error';
        $response_array['message'] = 'An error occurred. Please try again later.';
    }
    echo json_encode($response_array);
}

这些数据流任务中的每一个都执行存储过程并将数据导出到同一个excel文件。他们都独立工作。      但是,当我连接数据流任务以便一个接一个地执行时,第一个执行并将数据导出到excel,然后打开导出的文件excel。     这会使其他数据流任务出错。     在第一个数据流任务完成后,如何防止excel文件打开?

0 个答案:

没有答案