Reputation: 155
I have a CSV file that successfully moves from Source File to a staging table in a Data Flow Task from a sequence container. There will be a few sequences of this. I then need to move this data from the staging table to the main table that contains an extra column (Site). I am using a SQL task to move from staging to the main table. When I run this, it goes to my staging table but, never hits my main table.
Here is my Code in my Execute SQL Task
USE ENSTRDW
UPDATE
AxonOrders
SET
AxonOrders.OrderNbr = AxonOrdersExtractCleanCreated.OrderNbr
,AxonOrders.OrderStatus = AxonOrdersExtractCleanCreated.OrderStatus
,AxonOrders.OrderEndDate = AxonOrdersExtractCleanCreated.OrderEndDate
,AxonOrders.InvoiceDate = AxonOrdersExtractCleanCreated.InvoiceDate
,AxonOrders.OrderDate = AxonOrdersExtractCleanCreated.OrderDate
,AxonOrders.RevenuePerMile = AxonOrdersExtractCleanCreated.RevenuePerMile
,AxonOrders.ReadyToInvoice = AxonOrdersExtractCleanCreated.ReadyToInvoice
,AxonOrders.OrderCommodity = AxonOrdersExtractCleanCreated.OrderCommodity
,AxonOrders.OrderTractors = AxonOrdersExtractCleanCreated.OrderTractors
,AxonOrders.BillableMileage = AxonOrdersExtractCleanCreated.BillableMileage
,AxonOrders.Site = 'GT'
,AxonOrders.LastModified = AxonOrdersExtractCleanCreated.LastModified
,AxonOrders.VoidedOn = AxonOrdersExtractCleanCreated.VoidedOn
,AxonOrders.OrderDateTimeEntered = AxonOrdersExtractCleanCreated.OrderDateTimeEntered
FROM
AxonOrdersExtractCleanCreated
Upvotes: 2
Views: 610
Reputation: 37358
You should use an INSERT INTO command rather than UPDATE:
USE ENSTRDW;
INSERT INTO [AxonOrders](OrderNbr,OrderStatus,OrderEndDate,InvoiceDate,OrderDate,RevenuePerMile,ReadyToInvoice,
OrderCommodity,OrderTractors,BillableMileage,Site,LastModified,VoidedOn,OrderDateTimeEntered)
SELECT
OrderNbr,OrderStatus,OrderEndDate,InvoiceDate,OrderDate,RevenuePerMile,ReadyToInvoice,
OrderCommodity,OrderTractors,BillableMileage,'GT',LastModified,VoidedOn,OrderDateTimeEntered
FROM
AxonOrdersExtractCleanCreated
Upvotes: 1