SELECT [Sheet1$].ID,
CLng([Sheet1$].RecordID) AS RecordID,
[Sheet1$].col1,
[Sheet1$].col2,
[Sheet1$].col3,
[Sheet1$].col4,
[Sheet1$].col5,
[Sheet2$].Name
FROM [Sheet1$]
INNER JOIN [Sheet2$] ON
[Sheet1$].RecordID = [Sheet2$].RecordID
I have the above sample SQL Command in an SSIS Excel Source component. As seen in that query i'm doing an inner join on two excel sheets (Sheet1 and Sheet2) in the same workbook.
At this point the query executes well with out any errors.
However, i am not able to join on a 3rd sheet (Sheet3). When i try to inner join on sheet3, i get the following error message.
An OLE DB record is available. Source: "Microsoft Access Database Engine" Hresult: 0x80040E14 Description: "Syntax error (missing operator) in query expression '[Sheet1$].RecordID = [Sheet2$].ReportID INNER JOIN [Sheet3$] ON [Sheet1$].RecordID = [Sheet3$].RecordID'
So i am basically unable to do an inner join on two or more excel sheets. I'm only able to inner join on one excel sheet. The syntax i am using works in SQL Server, so i am wondering if its supposed to work in a SSIS Excel source SQL Command as well since it seems to be using the Microsoft Access Database Engine.
Below is the query with the second join that is generating the above error:
SELECT [Sheet1$].ID,
CLng([Shee1$].RecordID) AS RecordID,
[Sheet1$].col1,
[Sheet1$].col2,
[Sheet1$].col3,
[Sheet1$].col4,
[Sheet1$].col5,
[Sheet2$].Name
FROM [Sheet1$]
INNER JOIN [Sheet2$] ON
[Sheet1$].RecordID = [Sheet2$].RecordID
INNER JOIN [Sheet3$] ON
[Sheet1$].RecordID = [Sheet3$].RecordID
Lets try to cheat:
Ok, i was doing it the wrong way. Microsoft access database engine used by the SSIS Excel Source component handles joins differently than SQL Server.
Quoted from Access-SQL: Inner Join with multiple tables
And confirmed at http://office.microsoft.com/en-001/access-help/inner-join-operation-HA001231487.aspx
So the below query now works