The SQL I've written returns the records for the job numbers I have in the WHERE clause. In the example of the WHERE clause, below, I have three current jobs but from time to time there will be more or fewer. I want to have the active job numbers listed in a text file that can be revised as necessary and have the SQL read the file and put the job numbers in a variable which would be referenced in the WHERE clause.
WHERE (dbo.RELDTL.JOB_NO IN ('640', '700', '725'))
Example Job Numbers text file (no header, just job number)
Two months from now it might be
I would probably write the text file with single quotes around the job numbers as management tends to change format.
This way I need only revise the text file, which anyone in the department cold do, rather than revise the SQL which I wouldn't want anyone to do.
I found some code that might do it but I "do not have permission to use the bulk load statement."
DECLARE @Job_numbers VARCHAR(10)
FROM OPENROWSET(BULK'c:\temp\job_numbers_file.txt', SINGLE_BLOB) x:
The text file would actually reside on the "K" drive in a different folder and be very small and at most have ten or fifteen job numbers in it, generally around six. The job numbers could be listed vertically or horizontally. I would appreciate any assistance, thank you.