0

MS SQL Server 2005 テーブルからデータを取得し、リンクされた MySQL テーブルに挿入しようとしています。クエリは次のとおりですが、機能していません。「Query Executed successfully, 0 Rows Affected」というメッセージが表示され続けます。どんな助けでも大歓迎です!

INSERT INTO OPENQUERY(WEBSITE, 'SELECT SalesID,Cust,OrderDate,PONum,PartNo,QTY,PartDesc,DiscPct,DueDate,ShipCity,ShipSt,OrderStatus,InvoiceNo,InvDate,OrderTotal FROM orders')
SELECT Orders.SalesID, Orders.CustDesc, Orders.DateEnt, Orders.PONum, OrderDet.PartNo, OrderDet.QtyOrdered, OrderDet.PartDesc, OrderDet.DiscPct, OrderDet.DueDate, Orders.ShipCity, Orders.ShipSt, OrderDet.Status, BillingDet.InvoiceNo, Billing.InvDate, Orders.OrderTotal
FROM Orders INNER JOIN OrderDet ON (Orders.OrderNo = OrderDet.OrderNo)
LEFT JOIN BillingDet ON (Orders.PONum = BillingDet.PONum)
LEFT JOIN Billing ON (BillingDET.InvoiceNo = Billing.InvoiceNo)
WHERE OrderDet.PartNo LIKE '%^%' AND Orders.DateEnt >='2011/12/31'
4

2 に答える 2

1

これをWEBSITE...orders試してみてください:

INSERT  INTO WEBSITE...orders
        (
          SalesID,
          Cust,
          OrderDate,
          PONum,
          PartNo,
          QTY,
          PartDesc,
          DiscPct,
          DueDate,
          ShipCity,
          ShipSt,
          OrderStatus,
          InvoiceNo,
          InvDate,
          OrderTotal
        )
        SELECT  Orders.SalesID,
                Orders.CustDesc,
                Orders.DateEnt,
                Orders.PONum,
                OrderDet.PartNo,
                OrderDet.QtyOrdered,
                OrderDet.PartDesc,
                OrderDet.DiscPct,
                OrderDet.DueDate,
                Orders.ShipCity,
                Orders.ShipSt,
                OrderDet.Status,
                BillingDet.InvoiceNo,
                Billing.InvDate,
                Orders.OrderTotal
        FROM    Orders
        INNER JOIN OrderDet
                ON ( Orders.OrderNo = OrderDet.OrderNo )
        LEFT JOIN BillingDet
                ON ( Orders.PONum = BillingDet.PONum )
        LEFT JOIN Billing
                ON ( BillingDET.InvoiceNo = Billing.InvoiceNo )
        WHERE   OrderDet.PartNo LIKE '%^%'
                AND Orders.DateEnt >= '2011/12/31'
于 2013-01-30T14:32:18.520 に答える
0

これを試して:

INSERT INTO WEBSITE...orders(SalesID, Cust, OrderDate, PONum, PartNo, QTY, PartDesc, DiscPct, DueDate,
ShipCity, ShipSt, OrderStatus, InvoiceNo, InvDate, OrderTotal)
SELECT O.SalesID, O.CustDesc, O.DateEnt, O.PONum, OrderDet.PartNo,
OrderDet.QtyOrdered, OrderDet.PartDesc, OrderDet.DiscPct, OrderDet.DueDate,
O.ShipCity, O.ShipSt, OD.Status, BD.InvoiceNo, B.InvDate,
O.OrderTotal
FROM Orders O
    INNER JOIN OrderDet OD
        ON (O.OrderNo = OD.OrderNo)
    LEFT JOIN BillingDet BD
        ON (O.PONum = BD.PONum)
    LEFT JOIN Billing B
        ON (BD.InvoiceNo = B.InvoiceNo)
WHERE OD.PartNo LIKE '%^%'
    AND O.DateEnt >='2011/12/31'
于 2013-01-30T14:31:47.113 に答える