Adding a query to SQL Server Import and Export Wizard

Viewed 18

I am wanting to update the inv_mast table with an excel spreadsheet. I was able to successfully do this by importing the data as a table and then running the query afterwards and then dropping the table. I am wanting to try and add it to the SSIS package, so I do everything in one step. The excel sheet has ItemID and a Price column to update inv_mast that also has the same columns.

But I am getting this error when I use the code that I use to already complete the process.

The statement could not be parsed.
Syntax error (missing operator) in query expression 'ExcelSheet.price2
FROM
P21PLAY.dbo.inv_mast IM
INNER JOIN
Sheet1$ ExcelSheet
ON
IM.item_id = S.item_id'. (Microsoft Office Access Database Engine)

]1

Here is the code I have.

BEGIN TRANSACTION 
UPDATE
P21PLAY.dbo.inv_mast
SET
P21PLAY.dbo.inv_mast.price2 = ExcelSheet.price2
FROM
P21PLAY.dbo.inv_mast IM
INNER JOIN
Sheet1$ ExcelSheet
ON 
IM.item_id = S.item_id;
DROP TABLE sheet1$
0 Answers
Related