Reputation: 463
SELECT
Table1.SourceName, Table2.TableName, Table3.SourceSQL,
Table1.SourcePath, Table4.ProcessType
FROM
Table1
INNER JOIN
Table3 ON Table1.SourceID = Table3.SourceID
INNER JOIN
Table2 ON Table3.ID = Table2.ID
INNER JOIN
Table4 ON Table1.ProcessID = Table4.ProcessID
WHERE
Table2.TableName = '[EXCEL COLUMN 1 ROW 1]'
OR Table2.TableName = '[EXCEL COLUMN 1 ROW 2]'
OR Table2.TableName = '[EXCEL COLUMN 1 ROW 3]'
...OR Table2.TableName = '[EXCEL COLUMN 1 ROW N]';
The query itself is not my question - there may be some inconsistencies because I altered table/row names in the Select and Join statements.
I'm focused on the Where clause - is there a way I can pull records from an excel spreadsheet (records all in the same column) into this query without writing each one in manually. I'm using MS SQL Server Management Studio 2014.
Let me know if more information is needed.
Upvotes: 0
Views: 3572
Reputation: 910
You could try installing the access database engine from here https://www.microsoft.com/en-us/download/details.aspx?id=13255 and trying to create a linked server to the excel sheet as mentioned here https://social.msdn.microsoft.com/Forums/sqlserver/en-US/3019b4ec-fd3e-41c3-8f2e-cd85dc180ef4/sql-2012-64-bit-linked-server-to-excel-2013-64-bit?forum=transactsql
Upvotes: 1