Creating a variable list from an input file to use in TSQL select statement - SQL Server
Posted on 2014-01-24
I have an input file that has a list of four character variables. The number of rows on the file can vary. This list has the codes that I would like to select from a Sql Server table.
Unfortunately the way our system is set up you cannot read an external file into the select statement which reads the table directly.
i.e. Select * from Table A where code in (Select code from input_file)
Does anyone know of an efficient way to pull only the codes on the list without hard coding them in the select statement (since the codes can change) or reading the entire file into a temporary table and then selecting only the codes on the input file.